package se.urmo.game.graphics; import lombok.Getter; import java.awt.image.BufferedImage; public class SpriteSheet { private final BufferedImage[][] spriteSheet; @Getter private final SpriteLocation location; public SpriteSheet(SpriteLocation location) { this.location = location; this.spriteSheet = location.loadSprites(location.getSize()); } public BufferedImage getSprite(int row, int col) { if (location == SpriteLocation.NONE) { return null; } if (row >= spriteSheet.length || col >= spriteSheet[0].length) { return null; } return spriteSheet[row][col]; } public BufferedImage[] getAnimation(int row) { if(location == SpriteLocation.NONE) return null; if(row>= spriteSheet.length) return null; return spriteSheet[row]; } }