Interface IMobileEntity
- All Superinterfaces:
ICollisionEntity,IEntity
- All Known Implementing Classes:
Creature
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThis listener interface receives events when an entity was moved. -
Method Summary
Modifier and TypeMethodDescriptionintGets a value that defines how long it takes the entity to reach the full velocity (in ms).default doublegetAcceleration(double deltaTime) Gets the corrected acceleration velocity for movement calculationsintGets a value that defines how long it takes the entity to stop when slowing down from movements (in ms).default doublegetDeceleration(double deltaTime, double velocity) Gets the corrected deceleration velocity for movement calculationsfloatGets the entity's velocity in PIXELS per tick.Gets the entity's velocity in PIXELS per Second.movement()Gets the movement controller.voidonMoved(IMobileEntity.EntityMovedListener listener) Adds the specified entity moved listener to receive events when this entity was moved.voidRemoves 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.booleanGets 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
-
getAcceleration
default double getAcceleration(double deltaTime) Gets the corrected acceleration velocity for movement calculations- Parameters:
deltaTime- Delta time- Returns:
- the corrected 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
-
getDeceleration
default double getDeceleration(double deltaTime, double velocity) Gets the corrected deceleration velocity for movement calculations- Parameters:
deltaTime- Delta timevelocity- Current velocity- Returns:
- the corrected deceleration value
-
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:
-
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
-