Interface IMobileEntity
- All Superinterfaces:
ICollisionEntity
,IEntity
- All Known Implementing Classes:
Creature
public interface IMobileEntity
extends ICollisionEntity
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
IMobileEntity.EntityMovedListener
This listener interface receives events when an entity was moved.Method Summary
Modifier and Type Method Description int
getAcceleration()
Gets a value that defines how long it takes the entity to reach the full velocity (in ms).int
getDeceleration()
Gets a value that defines how long it takes the entity to stop when slowing down from movements (in ms).float
getTickVelocity()
Gets the entity's velocity in PIXELS per tick.Attribute<java.lang.Float>
getVelocity()
Gets the entity's velocity in PIXELS per Second.IMovementController
movement()
Gets the movement controller.void
onMoved(IMobileEntity.EntityMovedListener listener)
Adds the specified entity moved listener to receive events when this entity was moved.void
removeMovedListener(IMobileEntity.EntityMovedListener listener)
Removes the specified entity moved listener.void
setAcceleration(int acceleration)
Sets the acceleration for this entity.void
setDeceleration(int deceleration)
Sets the deceleration for this entity.void
setTurnOnMove(boolean turn)
Sets the turn on move parameter for this entity.void
setVelocity(float velocity)
Sets the base value on the velocity attribute of this instance.boolean
turnOnMove()
Gets the turn on move parameter for this entity.Methods inherited from interface de.gurkenlabs.litiengine.entities.ICollisionEntity
canCollideWith, fireCollisionEvent, getCollisionBox, getCollisionBox, getCollisionBoxAlign, getCollisionBoxCenter, getCollisionBoxHeight, getCollisionBoxValign, getCollisionBoxWidth, getCollisionType, hasCollision, onCollision, removeCollisionListener, setCollision, setCollisionBoxAlign, setCollisionBoxHeight, setCollisionBoxValign, setCollisionBoxWidth, setCollisionType
Methods inherited from interface de.gurkenlabs.litiengine.entities.IEntity
actions, addController, addEntityRenderListener, addListener, addTag, addTransformListener, animations, attachControllers, behavior, detachControllers, getAngle, getBoundingBox, getCenter, getController, getEnvironment, getHeight, getLocation, getMapId, getName, getProperties, getRenderType, getTags, getWidth, getX, getY, hasTag, isLoaded, isVisible, loaded, onMessage, onMessage, onRendered, perform, register, removed, removeListener, removeListener, removeListener, removeListener, removeListener, removeTag, renderWithLayer, sendMessage, setAngle, setController, setHeight, setLocation, setLocation, setMapId, setName, setRenderType, setRenderWithLayer, setSize, setVisible, setWidth, setX, setY
Method Details
onMoved
Adds the specified entity moved listener to receive events when this entity was moved.In comparison to the
EntityTransformListener.locationChanged(IEntity)
event, this provides some additional information about the movement (e.g. distance) and is only fired if the entity instance is currently loaded.- Parameters:
listener
- The listener to add.
removeMovedListener
Removes the specified entity moved listener.- Parameters:
listener
- The listener to remove.
getAcceleration
int getAcceleration()Gets a value that defines how long it takes the entity to reach the full velocity (in ms).- Returns:
- the acceleration value
getDeceleration
int getDeceleration()Gets a value that defines how long it takes the entity to stop when slowing down from movements (in ms).- Returns:
- the deceleration value
getVelocity
Attribute<java.lang.Float> getVelocity()Gets the entity's velocity in PIXELS per Second.- Returns:
- the velocity in pixel per second.
getTickVelocity
float getTickVelocity()Gets the entity's velocity in PIXELS per tick.- Returns:
- The velocity in pixel per tick.
movement
IMovementController movement()Gets the movement controller.- Returns:
- the movement controller
setAcceleration
void setAcceleration(int acceleration)Sets the acceleration for this entity. Acceleration is a value that defines how long it takes the entity to reach the full velocity when starting to move (in ms). *- Parameters:
acceleration
- the new acceleration
setDeceleration
void setDeceleration(int deceleration)Sets the deceleration for this entity. deceleration is a value that defines how long it takes the entity to stop when slowing down from movements (in ms).- Parameters:
deceleration
- the new deceleration
setTurnOnMove
void setTurnOnMove(boolean turn)Sets the turn on move parameter for this entity. It specifies if the entity will change its angle to the direction of the move destination when moved.- Parameters:
turn
- the new turn on move parameter.
setVelocity
void setVelocity(float velocity)Sets the base value on the velocity attribute of this instance.- Parameters:
velocity
- The velocity to be set.- See Also:
getVelocity()
turnOnMove
boolean turnOnMove()Gets the turn on move parameter for this entity. It specifies if the entity will change its angle to the direction of the move destination when moved.- Returns:
- true, if the entity will change its angle to the direction of the move destination when being moved