public class AnimatedEntity extends AbstractEntity implements Animatable
GAME_DIAGLENGTH, GAME_DIAGLENGTH2, GAME_EDGELENGTH, OBJECTTYPESNUM, SCREEN_DEPTH, SCREEN_DEPTH2, SCREEN_DEPTH4, SCREEN_HEIGHT, SCREEN_HEIGHT2, SCREEN_HEIGHT4, SCREEN_WIDTH, SCREEN_WIDTH2, SCREEN_WIDTH4, VALUESNUM
Constructor and Description |
---|
AnimatedEntity(int id,
int value,
AbstractPosition pos,
int[] animationsinformation,
boolean autostart,
boolean loop)
Create an entity with an animation with an array wich has the time of every animation step in ms in it.
|
Modifier and Type | Method and Description |
---|---|
void |
ignoreGameSpeed(boolean ignore)
ignores the delta time of the game world. use this if you want to have an animation independent of game speed (e.g. slow motion.)
|
void |
start()
Starts the animation.
|
void |
stop()
Stops the animation.
|
void |
update(float delta)
updates the entity and the animation.
|
dispose, exist, existing, getCategory, getDimensionZ, getName, getPosition, onGround, render, setDimensionZ, setHeight, setPosition, shouldBeDisposed
getDrawCalls, getId, getLightlevel, getPixmap, getRotation, getSprite, getSprites, getSpritesheet, getValue, increaseDrawCalls, isClipped, isHidden, isObstacle, isTransparent, loadSheet, prepareColor, render, render, render, render, render, render, render, resetDrawCalls, setClipped, setHidden, setLightlevel, setObstacle, setRotation, setTransparent, setValue, staticDispose, updateStaticUpdates
public AnimatedEntity(int id, int value, AbstractPosition pos, int[] animationsinformation, boolean autostart, boolean loop)
id
- The id of the objectvalue
- the starting valuepos
- the position of the entityanimationsinformation
- the time in ms for each animation stepautostart
- True when it should automatically start.loop
- Set to true when it should loop, when false it stops after one time.public void update(float delta)
update
in class AbstractGameObject
delta
- the time wich has passed since last updatepublic void start()
Animatable
start
in interface Animatable
public void stop()
Animatable
stop
in interface Animatable
public void ignoreGameSpeed(boolean ignore)
ignore
- true ignores game time