当前位置: 首页>>代码示例>>Java>>正文


Java SpriteSheet类代码示例

本文整理汇总了Java中org.newdawn.slick.SpriteSheet的典型用法代码示例。如果您正苦于以下问题:Java SpriteSheet类的具体用法?Java SpriteSheet怎么用?Java SpriteSheet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SpriteSheet类属于org.newdawn.slick包,在下文中一共展示了SpriteSheet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setTileSetImage

import org.newdawn.slick.SpriteSheet; //导入依赖的package包/类
/**
 * Set the image to use for this sprite sheet image to use for this tileset
 * 
 * @param image
 *            The image to use for this tileset
 */
public void setTileSetImage(Image image) {
	tiles = new SpriteSheet(image, tileWidth, tileHeight, tileSpacing,
			tileMargin);
	tilesAcross = tiles.getHorizontalCount();
	tilesDown = tiles.getVerticalCount();

	if (tilesAcross <= 0) {
		tilesAcross = 1;
	}
	if (tilesDown <= 0) {
		tilesDown = 1;
	}

	lastGID = (tilesAcross * tilesDown) + firstGID - 1;
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:22,代码来源:TileSet.java

示例2: init

import org.newdawn.slick.SpriteSheet; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
	this.container = container;
	
	sheet = new PackedSpriteSheet("testdata/testpack.def", Image.FILTER_NEAREST);
	rocket = sheet.getSprite("rocket");
	
	SpriteSheet anim = sheet.getSpriteSheet("runner");
	runner = new Animation();
	
	for (int y=0;y<2;y++) {
		for (int x=0;x<6;x++) {
			runner.addFrame(anim.getSprite(x,y), 50);
		}
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:19,代码来源:PackedSheetTest.java

示例3: init

import org.newdawn.slick.SpriteSheet; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
	this.container = container;
	
	SpriteSheet sheet = new SpriteSheet("testdata/homeranim.png", 36, 65);
	animation = new Animation();
	for (int i=0;i<8;i++) {
		animation.addFrame(sheet.getSprite(i,0), 150);
	}
	limited = new Animation();
	for (int i=0;i<8;i++) {
		limited.addFrame(sheet.getSprite(i,0), 150);
	}
	limited.stopAt(7);
	manual = new Animation(false);
	for (int i=0;i<8;i++) {
		manual.addFrame(sheet.getSprite(i,0), 150);
	}
	pingPong = new Animation(sheet, 0,0,7,0,true,150,true);
	pingPong.setPingPong(true);
	container.getGraphics().setBackground(new Color(0.4f,0.6f,0.6f));
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:25,代码来源:AnimationTest.java

示例4: init

import org.newdawn.slick.SpriteSheet; //导入依赖的package包/类
@Override
	public void init(GameContainer container) throws SlickException {
		this.container = container;
		this.map = new TiledMap("/home/enzo/newmap.tmx");

		SpriteSheet spriteSheet = new SpriteSheet("/home/enzo/SpriteSheetAnim.png", 64, 64);
		this.animations[0] = loadAnimation(spriteSheet, 0, 1, 0);
		this.animations[1] = loadAnimation(spriteSheet, 0, 1, 1);
		this.animations[2] = loadAnimation(spriteSheet, 0, 1, 2);
		this.animations[3] = loadAnimation(spriteSheet, 0, 1, 3);
		this.animations[4] = loadAnimation(spriteSheet, 1, 9, 0);
		this.animations[5] = loadAnimation(spriteSheet, 1, 9, 1);
		this.animations[6] = loadAnimation(spriteSheet, 1, 9, 2);
		this.animations[7] = loadAnimation(spriteSheet, 1, 9, 3);
	
		Font font = new Font("Verdana", Font.BOLD, 20);
		UnicodeFont uFont = new UnicodeFont(font, font.getSize(), font.isBold(), font.isItalic());
		nameInput = new TextField(container, uFont, 150,20,500,35, new ComponentListener()
	        {
	         public void componentActivated(AbstractComponent source) {
	            message = "Entered1: "+nameInput.getText();
	            nameInput.setFocus(true);
	         }

	    });
		
//		ComponentListener listener = new ComponentListener();
//		TextField nameInput = new TextField(arg0, truetypefont, 150,20,500,35, listener);
//		
//		{
//	        public void componentActivated(AbstractComponent source) {
//	           System.out.println("Entered1: "+nameInput.getText());
//	        }
//	   });
	
	}
 
开发者ID:EnzoMolion,项目名称:Projet-PLA,代码行数:37,代码来源:WindowGame.java

示例5: Monster4

import org.newdawn.slick.SpriteSheet; //导入依赖的package包/类
public Monster4(int playerNumber) throws SlickException {
        super();
        skillIcons = new Image[]{
                new Image("Assets/Graphics/Monster and Human Sprites/Root/Root - 1 Leaf Icon.png"),
                new Image("Assets/Graphics/Monster and Human Sprites/Flame/Firefly.png"),
                new Image("Assets/Graphics/Monster and Human Sprites/Flame/X-Burner.png")
        };
        if (playerNumber == 1) {
            animationIdle = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Root/Root - Idle P1.png", 600, 300, 1), frameDurationMonsterIdle);
            animationHumanIdle = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Root/Root - Human P1.jpg", 150, 150, 1), frameDurationHumanIdle);

            animationSkill1 = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Root/Root - 1 Leaf Icon P1.png", 600, 300, 1), frameDurationSkill1);
            animationSkill2 = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Root/Root - 1 Leaf Icon P1.png", 600, 300, 1), frameDurationSkill2);
            animationSkillUlt = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Root/Root - 1 Leaf Icon P1.png", 600, 300, 1), frameDurationSkillUlt);

            // TODO uncomment when sprites for player2 (flipper player1 sprites) are done
//        } else if (playerNumber == 2) {
//            animationIdle = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - Idle P2.png", 600, 300, 1), 250);
//            animationHumanIdle = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - Human P2.png", 600, 300, 1), 250);

//            animationSkill1 = new Animation(new SpriteSheet("Assets/Graphics/Monster Skills Sprites/Blueffy/Blueffy - 1 Blistol P2.png", 600, 300, 1), 250);
//            animationSkill2 = new Animation(new SpriteSheet("Assets/Graphics/Monster Skills Sprites/Blueffy/Blueffy - 2 Gatling P2.png", 600, 300, 1), 250);
//            animationSkillUlt = new Animation(new SpriteSheet("Assets/Graphics/Monster Skills Sprites/Blueffy/Blueffy - 3 Bluezooka P2.png", 600, 300, 1), 250);
        }

    }
 
开发者ID:earlmalaki,项目名称:BeatBitBeat,代码行数:27,代码来源:Monster4.java

示例6: Monster6

import org.newdawn.slick.SpriteSheet; //导入依赖的package包/类
public Monster6(int playerNumber) throws SlickException {
        super();

        if (playerNumber == 1) {
            animationIdle = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - Idle P1.png", 600, 300, 1), 250);
            animationHumanIdle = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - Human P1.jpg", 600, 300, 1), 250);

            animationSkill1 = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - 1 Blistol P1.png", 600, 300, 1), 250);
            animationSkill2 = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - 2 Gatling P1.png", 600, 300, 1), 250);
            animationSkillUlt = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - 3 Bluezooka P1.png", 600, 300, 1), 250);

            // TODO uncomment when sprites for player2 (flipper player1 sprites) are done
//        } else if (playerNumber == 2) {
//            animationIdle = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - Idle P2.png", 600, 300, 1), 250);
//            animationHumanIdle = new Animation(new SpriteSheet("Assets/Graphics/Monster and Human Sprites/Blueffy/Blueffy - Human P2.png", 600, 300, 1), 250);

//            animationSkill1 = new Animation(new SpriteSheet("Assets/Graphics/Monster Skills Sprites/Blueffy/Blueffy - 1 Blistol P2.png", 600, 300, 1), 250);
//            animationSkill2 = new Animation(new SpriteSheet("Assets/Graphics/Monster Skills Sprites/Blueffy/Blueffy - 2 Gatling P2.png", 600, 300, 1), 250);
//            animationSkillUlt = new Animation(new SpriteSheet("Assets/Graphics/Monster Skills Sprites/Blueffy/Blueffy - 3 Bluezooka P2.png", 600, 300, 1), 250);
        }

    }
 
开发者ID:earlmalaki,项目名称:BeatBitBeat,代码行数:23,代码来源:Monster6.java

示例7: getWallImage

import org.newdawn.slick.SpriteSheet; //导入依赖的package包/类
private static Image getWallImage(GameMap map, int x, int y) {
	SpriteSheet sheet = ResourceManager.getSpriteSheet("walls");
	Image tile;

	boolean above = isWall(map, x, y - 1);
	boolean left = isWall(map, x - 1, y);
	boolean right = isWall(map, x + 1, y);
	boolean below = isWall(map, x, y + 1);

	int index = calculateTileIndex(above, below, left, right);
	if (index < 10) {
		tile = sheet.getSprite(index, 0);
	} else {
		tile = sheet.getSprite(index - 10, 1);
	}
	return tile;
}
 
开发者ID:Gornova,项目名称:CryptoRl2,代码行数:18,代码来源:TileFactory.java

示例8: loadPlayerFeet

import org.newdawn.slick.SpriteSheet; //导入依赖的package包/类
public static Animation[] loadPlayerFeet() {
	SpriteSheet sprites = new SpriteSheet(loadImage("feet.png"), 64, 64);

	Animation[] model = new Animation[8];

	Image[] frames = new Image[8];
	for (int angle = 0, j = 0; angle < 360; angle += 45, j++) {
		for (int i = 0; i < 8; i++) {
			Image temp = sprites.getSprite(0, i);
			temp.rotate(angle);
			frames[i] = temp;
		}
		model[j] = new Animation(frames, 100);
	}

	return model;
}
 
开发者ID:JavaJumperStudios,项目名称:Saboteur,代码行数:18,代码来源:RessourceManager.java

示例9: initStatesList

import org.newdawn.slick.SpriteSheet; //导入依赖的package包/类
@Override
public void initStatesList(GameContainer gc) throws SlickException {
	
	new SoundBank();
	
	GAME_FONT = new SpriteSheetFont(new SpriteSheet(Main.loadImage("res/font.png"), 16, 22), ' ');
	GAME_FONT_2 = new SpriteSheetFont(new SpriteSheet(Main.loadImage("res/font2.png"), 16, 22), ' ');
	CURSOR_IMAGES = new SpriteSheet(Main.loadImage("res/cursors.png"), 32, 32);
	USEFUL_BUTTONS = new SpriteSheet(Main.loadImage("res/buttons2.png"), 32, 32);
	BIG_BUTTON = new SpriteSheet(Main.loadImage("res/button.png"), 128, 32);
	gc.setMouseCursor(CURSOR_IMAGES.getSprite(2, 0), 0, 0);
	
	if (!devMode) {
	
		this.addState(new CyboticCatfish());
		this.addState(new LoginScreen());
		this.enterState(0);
	
	} else {
		
		this.addState(new Game(filePath, "test", "test"));
		this.enterState(3);
		
	}
	
}
 
开发者ID:CyboticCatfish,项目名称:code404,代码行数:27,代码来源:Main.java

示例10: generateRandomCustomer

import org.newdawn.slick.SpriteSheet; //导入依赖的package包/类
/**
 * Creates the Customer
 * @param business
 * @param listOfActions
 * @param simulationSpeed
 * @throws SlickException
 */
private void generateRandomCustomer(Business business, ArrayList<Action> listOfActions, int simulationSpeed) throws SlickException {
	
	SpriteSheet[] charSpriteSheets = ResourceLoader.getInstance().getRandomCustomerSpriteSheet();
	
	Customer c = new Customer(business.getStore().getCharacters().size(),
		com.lucasdnd.ags.system.ResourceLoader.getInstance().tinyBlackFont,
		com.lucasdnd.ags.system.ResourceLoader.getInstance().tinyLightGrayFont,
		charSpriteSheets[0],
		charSpriteSheets[1],
		listOfActions,
		simulationSpeed,
		business.getStore());
	
	customersToGenerate.add(c);
}
 
开发者ID:lucas-tulio,项目名称:awesome-game-store,代码行数:23,代码来源:Market.java

示例11: Character

import org.newdawn.slick.SpriteSheet; //导入依赖的package包/类
protected Character(int id, SpriteSheet spriteSheet, Font font, Font shadowFont) throws SlickException {
	super(id, spriteSheet);
	
	// Basic stuff
	moving = false;
	xSize = 1;
	ySize = 1;
	state = IDLE;
	targetAsset = null;
	canBeDisposed = false;
	
	// Floating Text
	floatingText = new FloatingText(font, shadowFont, xPos * 2, yPos * 2, xOffset * 2, yOffset * 2, this.image[0].getWidth(), this.image[0].getHeight(), 3000);
	floatingMoney = new FloatingText(ResourceLoader.getInstance().tinyGreenFont, shadowFont, xPos * 2, yPos * 2, xOffset * 2, yOffset * 2 - 22f, this.image[0].getWidth(), this.image[0].getHeight(), 3000);
	floatingMoney.setLocalYOffset(-100f);
}
 
开发者ID:lucas-tulio,项目名称:awesome-game-store,代码行数:17,代码来源:Character.java

示例12: setSkin

import org.newdawn.slick.SpriteSheet; //导入依赖的package包/类
public void setSkin() {
    for (String skin : mSkinParts) {
        Image img = (Image) DatasManager.getInstance().getFile(skin);
        SpriteSheet s = new SpriteSheet(img, img.getWidth() / 3, img.getHeight() / 4);
        Animation[] anim = new Animation[8];
        anim[0] = loadAnimation(s, 0, 0, 3); // Haut
        anim[1] = loadAnimation(s, 0, 1, 3); // Gauche
        anim[2] = loadAnimation(s, 0, 2, 3); // Droite
        anim[3] = loadAnimation(s, 0, 3, 3); // Bas
        anim[4] = loadAnimation(s, 1, 0, 2); // Haut qui bouge pas
        anim[5] = loadAnimation(s, 1, 1, 2); // Gauche qui bouge pas
        anim[6] = loadAnimation(s, 1, 2, 2); // Droite qui bouge pas
        anim[7] = loadAnimation(s, 1, 3, 2); // Bas qui bouge pas
        mAnimations.add(anim);
    }
}
 
开发者ID:AlexMog,项目名称:MMO-Rulemasters-World,代码行数:17,代码来源:OnlineEntity.java

示例13: EntityHarvester

import org.newdawn.slick.SpriteSheet; //导入依赖的package包/类
public EntityHarvester(Float posX, Float posY, Team team, Player player) {
super(posX, posY, team, player, TEXTURE_WIDTH, TEXTURE_HEIGHT);

boundingBox.setBounds(posX + 6, posY - 6, (TEXTURE_WIDTH / 2), (TEXTURE_HEIGHT / 2));
texture = new SpriteSheet(ResourceManager.getInstance().getConquerTexture(TEXTURE_NAME).getAsCombinedImage(owner.playerColor), TEXTURE_WIDTH, TEXTURE_HEIGHT);
Random r = new Random();

this.setHp(600);
this.setMaxHp(600);

this.contents = new HashMap<>();

this.ordersList.add(new HarvestTargeter(this));
this.ordersList.add(new DeliverTargeter(this));

this.setName("harv");

this.requiredToBuild.add(EntityWarFactory.class);
this.requiredToBuild.add(EntityProc.class);
   }
 
开发者ID:Cr0s,项目名称:JavaRA,代码行数:21,代码来源:EntityHarvester.java

示例14: ShroudRenderer

import org.newdawn.slick.SpriteSheet; //导入依赖的package包/类
public ShroudRenderer(World aW) {
this.w = aW;

this.shroudMap = new ShroudTile[w.getMap().getWidth()][w.getMap().getHeight()];
for (int x = 0; x < w.getMap().getWidth(); x++) {
    for (int y = 0; y < w.getMap().getHeight(); y++) {
	this.shroudMap[x][y] = new ShroudTile(x * 24, y * 24, 0);
    }
}	

this.shroudsSheet = new SpriteSheet(ResourceManager.getInstance().getConquerTexture("shadow.shp").getAsCombinedImage(null, true, 0, 0), 24, 24);

spriteMap = new short[256];
for (short i = 0; i < index.length; i++)
    spriteMap[index[i]] = i;

   }
 
开发者ID:Cr0s,项目名称:JavaRA,代码行数:18,代码来源:ShroudRenderer.java

示例15: Nazi

import org.newdawn.slick.SpriteSheet; //导入依赖的package包/类
public Nazi(float x, float y) throws SlickException {
	super(x, y);

	dos = null;
	lifeAddTimeout = new Random().nextInt(30);

	naziSheet = new SpriteSheet("org/dosimonline/res/sprites/nazi.png", 20,
			55);
	naziWalkLeft = new Animation();
	naziWalkLeft.setAutoUpdate(true);
	naziWalkLeft.addFrame(
			naziSheet.getSprite(0, 0).getFlippedCopy(true, false), 150);
	naziWalkLeft.addFrame(
			naziSheet.getSprite(1, 0).getFlippedCopy(true, false), 150);

	naziWalkRight = new Animation();
	naziWalkRight.setAutoUpdate(true);
	naziWalkRight.addFrame(naziSheet.getSprite(0, 0), 150);
	naziWalkRight.addFrame(naziSheet.getSprite(1, 0), 150);

	addType("Anti Semitic"); // Gilnaa: lol wut
	setHitBox(0, 20, 20, 35);
}
 
开发者ID:Dosim-Online,项目名称:DosimOnline.Models,代码行数:24,代码来源:Nazi.java


注:本文中的org.newdawn.slick.SpriteSheet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。