Class SpriteAnimations

java.lang.Object
io.github.team6ENG.EscapeUni.SpriteAnimations
Direct Known Subclasses:
Goose, Player

public class SpriteAnimations extends Object
Cuts sprite sheets up into animations
  • Field Details

    • animations

      public HashMap<String,com.badlogic.gdx.graphics.g2d.Animation<com.badlogic.gdx.graphics.g2d.TextureRegion>> animations
    • x

      public float x
    • y

      public float y
    • wallsLayer

      protected com.badlogic.gdx.maps.tiled.TiledMapTileLayer wallsLayer
    • mapWallsId

      protected int mapWallsId
    • tileDimensions

      protected int tileDimensions
  • Constructor Details

    • SpriteAnimations

      public SpriteAnimations(String file, int SheetCols, int SheetRows)
      Loads sprite sheet
      Parameters:
      file - path of sprite sheet
      SheetCols - Number of columns in sheet
      SheetRows - Number of rows in sheet
  • Method Details

    • loadSprite

      public void loadSprite(com.badlogic.gdx.maps.tiled.TiledMapTileLayer walls, int id, int d)
      Stores map info for later boundary detection
      Parameters:
      walls - tilemap of game walls
      id - tilemap layer which represents the walls
      d - dimentions of each tile on the map i.e. 8 or 16
    • generateAnimation

      protected void generateAnimation(HashMap<String,Integer[]> animInfo, float animationSpeed)
      Cuts the sprite sheet up Stores resulting animations into animations dictionary
      Parameters:
      animInfo - dictionary of sprite sheet layout: key - Name of animation Value - Array representing row of animation on sprite sheet and index of start and end frames
      animationSpeed - number of seconds each animation frame should last
    • dispose

      public void dispose()