public class TileSprite
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private int |
animationSpeed |
private int |
currentFrame |
private java.util.List<org.newdawn.slick.Image> |
frames |
private int |
height |
private int |
width |
Constructor and Description |
---|
TileSprite(org.newdawn.slick.Image image) |
TileSprite(int animationSpeed) |
TileSprite(int animationSpeed,
org.newdawn.slick.Image[][] image) |
TileSprite(int animationSpeed,
java.util.List<org.newdawn.slick.Image> image) |
Modifier and Type | Method and Description |
---|---|
void |
addFrame(org.newdawn.slick.Image frame) |
static java.util.List<TileSprite> |
autoConstructSprites(org.newdawn.slick.Image[][] image) |
int |
getAnimationSpeed() |
int |
getCurrentFrame() |
java.util.List<org.newdawn.slick.Image> |
getFrames() |
int |
getHeight() |
int |
getWidth() |
void |
incrementFrame()
increase the current frame by one
|
void |
removeAllFrame()
Removes all frames
|
void |
removeFrame(org.newdawn.slick.Image frame) |
void |
render(int x,
int y) |
void |
setAnimationSpeed(int animationSpeed) |
void |
setCurrentFrame(int currentFrame) |
void |
setHeight(int height) |
void |
setWidth(int width) |
private int height
private int width
private java.util.List<org.newdawn.slick.Image> frames
private int currentFrame
private int animationSpeed
public TileSprite(org.newdawn.slick.Image image)
public TileSprite(int animationSpeed)
animationSpeed
- the animation speed in millisecondspublic TileSprite(int animationSpeed, org.newdawn.slick.Image[][] image)
height
- height of the spritewidth
- width of the spriteanimationSpeed
- animationSpeed of sprite in millisecondsimage
- list of images to be included in animation looppublic TileSprite(int animationSpeed, java.util.List<org.newdawn.slick.Image> image)
public static java.util.List<TileSprite> autoConstructSprites(org.newdawn.slick.Image[][] image)
image
- 2D array of imagespublic void render(int x, int y)
public int getHeight()
public void setHeight(int height)
height
- the height to setpublic int getWidth()
public void setWidth(int width)
width
- the width to setpublic java.util.List<org.newdawn.slick.Image> getFrames()
public void addFrame(org.newdawn.slick.Image frame)
frame
- adds a framepublic void removeFrame(org.newdawn.slick.Image frame)
frame
- removes a framepublic void removeAllFrame()
public int getCurrentFrame()
public void setCurrentFrame(int currentFrame)
currentFrame
- the currentFrame to setpublic void incrementFrame()
public int getAnimationSpeed()
public void setAnimationSpeed(int animationSpeed)
animationSpeed
- the animationSpeed to set