Interface IMobileEntity
- All Superinterfaces:
ICollisionEntity,IEntity
- All Known Implementing Classes:
Creature
public interface IMobileEntity
extends ICollisionEntityNested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceIMobileEntity.EntityMovedListenerThis listener interface receives events when an entity was moved.Method Summary
Modifier and Type Method Description intgetAcceleration()Gets a value that defines how long it takes the entity to reach the full velocity (in ms).intgetDeceleration()Gets a value that defines how long it takes the entity to stop when slowing down from movements (in ms).floatgetTickVelocity()Gets the entity's velocity in PIXELS per tick.Attribute<java.lang.Float>getVelocity()Gets the entity's velocity in PIXELS per Second.IMovementControllermovement()Gets the movement controller.voidonMoved(IMobileEntity.EntityMovedListener listener)Adds the specified entity moved listener to receive events when this entity was moved.voidremoveMovedListener(IMobileEntity.EntityMovedListener listener)Removes the specified entity moved listener.voidsetAcceleration(int acceleration)Sets the acceleration for this entity.voidsetDeceleration(int deceleration)Sets the deceleration for this entity.voidsetTurnOnMove(boolean turn)Sets the turn on move parameter for this entity.voidsetVelocity(float velocity)Sets the base value on the velocity attribute of this instance.booleanturnOnMove()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, setCollisionTypeMethods 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
