Class SpriteSheet


  • public class SpriteSheet
    extends java.lang.Object
    An image that contains multiple sprites, each represented by a row, or "strip" that is specified in the constructor
    See Also:
    Sprite
    • Constructor Summary

      Constructors 
      Constructor Description
      SpriteSheet​(org.newdawn.slick.Image sheet, int width)  
      SpriteSheet​(org.newdawn.slick.Image sheet, int rows, int frames)  
      SpriteSheet​(org.newdawn.slick.Image image, int width, int height, int rows, int frames)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private org.newdawn.slick.Image getRow​(int index)
      Returns the "strip" at the given index
      Sprite getSprite​(int index)  
      private void load()
      Builds the sprite collection from the sheet image (should have already been set)
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • spriteWidth

        private final int spriteWidth
      • spriteHeight

        private final int spriteHeight
      • strips

        private final int strips
      • stripWidth

        private final int stripWidth
      • frames

        private final int frames
      • sheet

        private final org.newdawn.slick.Image sheet
      • sprites

        public java.util.ArrayList<Sprite> sprites
    • Constructor Detail

      • SpriteSheet

        public SpriteSheet​(org.newdawn.slick.Image sheet,
                           int width)
      • SpriteSheet

        public SpriteSheet​(org.newdawn.slick.Image sheet,
                           int rows,
                           int frames)
      • SpriteSheet

        public SpriteSheet​(org.newdawn.slick.Image image,
                           int width,
                           int height,
                           int rows,
                           int frames)
    • Method Detail

      • load

        private void load()
        Builds the sprite collection from the sheet image (should have already been set)
      • getRow

        private org.newdawn.slick.Image getRow​(int index)
        Returns the "strip" at the given index
        Parameters:
        index - The row number, or index, of the "strip" to return in the strip
      • getSprite

        public Sprite getSprite​(int index)