public class Sprite
extends java.lang.Object
implements nl.colorize.util.animation.Animatable
Sprites can have multiple possible graphical states, with each state being represented by either a static image or by an animation. In addition to a graphical representation, each state also has a bounding shape, which is used to determine if sprites are colliding with each other. If not set, a state's bounding shape is the same size as the
| Constructor and Description |
|---|
Sprite() |
| Modifier and Type | Method and Description |
|---|---|
void |
addState(java.lang.String name,
Animation stateGraphics) |
void |
addState(java.lang.String name,
Animation stateGraphics,
Shape boundingShape) |
void |
addState(java.lang.String name,
Image stateGraphics) |
void |
addState(java.lang.String name,
Image stateGraphics,
Shape boundingShape) |
void |
changeState(java.lang.String name) |
java.util.Set<java.lang.String> |
getAvailableStates() |
Image |
getCurrentGraphics() |
java.lang.String |
getCurrentState() |
void |
onFrame(float deltaTime) |
public void addState(java.lang.String name,
Animation stateGraphics)
public void addState(java.lang.String name,
Image stateGraphics)
public void changeState(java.lang.String name)
public java.lang.String getCurrentState()
public java.util.Set<java.lang.String> getAvailableStates()
public void onFrame(float deltaTime)
onFrame in interface nl.colorize.util.animation.Animatablepublic Image getCurrentGraphics()