/** * 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; }
/** * @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); } } }
/** * @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)); }
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); } }
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); } }
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; }
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; }
@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); } }
/** * 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); }
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); }
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); } }
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); }
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; }
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); }
public static @Nonnull Animation spriteToAnimation(@Nonnull Image img, int horizontalTiles, int verticalTiles, int frameDuration) { SpriteSheet sheet = new SpriteSheet(img, img.getWidth() / horizontalTiles, img.getHeight() / verticalTiles); Animation anim = new Animation(); anim.setAutoUpdate(true); for (int y = 0; y < sheet.getVerticalCount(); y++) { for (int x = 0; x < sheet.getHorizontalCount(); x++) { anim.addFrame(sheet.getSprite(x, y), frameDuration); } } return anim; }
@Override public void init(GameContainer container, StateBasedGame game) throws SlickException { fontImage = new Image("res/font/lcd_solid_9_00.png"); fontImage.setFilter(Image.FILTER_NEAREST); font = new AngelCodeFont("res/font/lcd_solid_9.fnt", fontImage); backButtonImage = new Image("res/img/ui/backButton.png"); backButtonImage.setFilter(Image.FILTER_NEAREST); backButton = new Button(80f, 160f, backButtonImage.getWidth(), backButtonImage.getHeight(), backButtonImage); dealWithIt = new Image("res/img/ui/dealwithit.png"); dealWithIt.setFilter(Image.FILTER_NEAREST); dealWithItXPos = 36f; dealWithItYPos = -20f; dealWithItYTarget = 72f; printTheEnd = 0; printTheEndTarget = 1000; // Sprite sheep strikes back SpriteSheet spriteSheep = new SpriteSheet("res/img/character/bartender alpha.png", 16, 16); characterImage = spriteSheep.getSprite(3, 0); characterImage.setFilter(Image.FILTER_NEAREST); bookImage = new Image("res/img/items/book.png"); bookImage.setFilter(Image.FILTER_NEAREST); }
public Player(Vector2f pos) { super(pos); oxygenConsumptionPerSecond = (int) ConfigManager.playerOxygenConsumption; this.gbtype = GameBodyType.PLAYER; this.setMaxHealth(20); this.setHealth(20); this.accFactor = ConfigManager.playerAcc; halfSize.set(0.4f, 0.4f); try { headSprites = new SpriteSheet("assets/textures/animperso.png",256,256); headAnimation = new Animation(headSprites, 600); headAnimation.setPingPong(true); bodySprites = new SpriteSheet("assets/textures/playerBody.png",256,256); featherSprites = new SpriteSheet("assets/textures/feather.png",256,256); featherAnimation = new Animation(featherSprites, 50); featherAnimation.setPingPong(true); } catch (SlickException e) { e.printStackTrace(); } inventory = new Inventory(5,this); actionZone = new ActionZone(actionRange, position.x, position.y); actionZone.init(); }
public Energy(float x, float y, int charge){ super(x,y,ItemListEnum.ENERGY); weight = 100; gbtype = GameBodyType.ENERGY; this.charge = charge; this.halfSize.set(0.3f,0.3f); try { sprites = new SpriteSheet("assets/textures/energy.png",64,64); image = sprites.getSprite(0, 0); } catch (SlickException e) { e.printStackTrace(); } }
/** * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer) */ public void init(GameContainer container) throws SlickException { // force a 256 pixel limit for testing original = image = new BigImage("testdata/bigimage.tga", Image.FILTER_NEAREST, 512); sub = image.getSubImage(210,210,200,130); scaledSub = sub.getScaledCopy(2); image = image.getScaledCopy(0.3f); imageX = image.getFlippedCopy(true, false); imageY = imageX.getFlippedCopy(true, true); bigSheet = new SpriteSheet(original, 16, 16); }
/** * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer) */ public void init(GameContainer container) throws SlickException { image = new Image("testdata/rocket.png"); back = new Image("testdata/sky.jpg"); font = new AngelCodeFont("testdata/hiero.fnt","testdata/hiero.png"); SpriteSheet sheet = new SpriteSheet("testdata/homeranim.png", 36, 65); homer = new Animation(sheet, 0,0,7,0,true,150,true); }
@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()); // } // }); }