Class Entity
java.lang.Object
de.gurkenlabs.litiengine.entities.Entity
- All Implemented Interfaces:
EntityRenderedListener,EntityRenderListener,IEntity,Tweenable,EventListener
- Direct Known Subclasses:
CollisionEntity,Emitter,LightSource,MapArea,SoundSource,Spawnpoint
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionactions()All registered actions of this entity.voidaddController(IEntityController controller) voidaddEntityRenderListener(EntityRenderListener listener) Adds the specified entity render listener to receive events and callbacks about the rendering process of entities.voidaddListener(EntityListener listener) voidvoidaddTransformListener(EntityTransformListener listener) Gets the entities animation controller.voidbehavior()booleanThis method gets called before anEntityis about to be rendered.voiddoublegetAngle()<T extends IEntityController>
TgetController(Class<T> clss) protected EntityControllersGets the environment the entity was loaded to or null if it is not loaded.doubleintgetMapId()getName()Gets the name of this entity.getTags()float[]getTweenValues(TweenType tweenType) Gets one or many values from the target object associated to the given tween type.doublegetWidth()doublegetX()doublegetY()booleanbooleanisLoaded()Indicates whether this entity is loaded on the currently active environment.booleanvoidloaded(Environment environment) This method provides the possibility to implement behavior whenever this entity was added to the environment.voidonMessage(EntityMessageListener listener) voidonMessage(String message, EntityMessageListener listener) voidonRendered(EntityRenderedListener listener) Adds the specified entity rendered listener to receive events when entities were rendered.voidPerforms anEntityActionthat was previously registered for this entity.Registers anEntityActionwith the specified name.voidremoved(Environment environment) This method provides the possibility to implement behavior whenever this entity was removed from the environment.voidremoveListener(EntityListener listener) voidremoveListener(EntityMessageListener listener) voidremoveListener(EntityRenderedListener listener) Removes the specified entity rendered listener.voidremoveListener(EntityRenderListener listener) Removes the specified entity render listener.voidremoveListener(EntityTransformListener listener) voidvoidrendered(EntityRenderEvent event) This method gets called after an entity was rendered.voidrendering(EntityRenderEvent event) This method gets called after all rendering checks have successfully passed and right before the entity is about to be rendered.booleanDetermines whether this entity is being rendered with the layer it's originating from.sendMessage(Object sender, String message) voidsetAngle(double angle) Sets the angle (in degrees) in which the entity is directed.<T extends IEntityController>
voidsetController(Class<T> clss, T controller) voidsetHeight(double height) voidsetLocation(double x, double y) voidsetLocation(Point2D location) Sets the map location.voidsetMapId(int mapId) Sets an id which should only be filled when an entity gets added due to map information.voidvoidsetRenderType(RenderType renderType) voidsetRenderWithLayer(boolean renderWithLayer) voidsetSize(double width, double height) voidsetTweenValues(TweenType tweenType, float[] newValues) This method is called in a Tween's update() method to set the new interpolated values.voidsetVisible(boolean visible) voidsetWidth(double width) voidsetX(double x) voidsetY(double y) toString()
-
Field Details
-
ANY_MESSAGE
- See Also:
-
-
Constructor Details
-
Entity
protected Entity() -
Entity
protected Entity(boolean renderWithLayer) -
Entity
protected Entity(int mapId) -
Entity
-
Entity
-
-
Method Details
-
addTransformListener
- Specified by:
addTransformListenerin interfaceIEntity
-
removeListener
- Specified by:
removeListenerin interfaceIEntity
-
addListener
- Specified by:
addListenerin interfaceIEntity
-
removeListener
- Specified by:
removeListenerin interfaceIEntity
-
onRendered
Description copied from interface:IEntityAdds the specified entity rendered listener to receive events when entities were rendered.- Specified by:
onRenderedin interfaceIEntity- Parameters:
listener- The listener to add.
-
removeListener
Description copied from interface:IEntityRemoves the specified entity rendered listener.- Specified by:
removeListenerin interfaceIEntity- Parameters:
listener- The listener to remove.
-
addEntityRenderListener
Description copied from interface:IEntityAdds the specified entity render listener to receive events and callbacks about the rendering process of entities.- Specified by:
addEntityRenderListenerin interfaceIEntity- Parameters:
listener- The listener to add.
-
removeListener
Description copied from interface:IEntityRemoves the specified entity render listener.- Specified by:
removeListenerin interfaceIEntity- Parameters:
listener- The listener to remove.
-
onMessage
-
onMessage
-
removeListener
- Specified by:
removeListenerin interfaceIEntity
-
attachControllers
public void attachControllers()- Specified by:
attachControllersin interfaceIEntity
-
detachControllers
public void detachControllers()- Specified by:
detachControllersin interfaceIEntity
-
getProperties
- Specified by:
getPropertiesin interfaceIEntity
-
getAngle
public double getAngle() -
animations
Description copied from interface:IEntityGets the entities animation controller.- Specified by:
animationsin interfaceIEntity- Returns:
- The entities animation controller or null if none was registered.
- See Also:
-
behavior
-
addController
- Specified by:
addControllerin interfaceIEntity
-
setController
- Specified by:
setControllerin interfaceIEntity
-
getController
- Specified by:
getControllerin interfaceIEntity
-
getBoundingBox
- Specified by:
getBoundingBoxin interfaceIEntity
-
getCenter
-
getHeight
public double getHeight() -
getLocation
- Specified by:
getLocationin interfaceIEntity
-
getMapId
public int getMapId() -
getName
Description copied from interface:IEntityGets the name of this entity. -
getRenderType
- Specified by:
getRenderTypein interfaceIEntity
-
getWidth
public double getWidth() -
getX
public double getX() -
getY
public double getY() -
isVisible
public boolean isVisible() -
setVisible
public void setVisible(boolean visible) - Specified by:
setVisiblein interfaceIEntity
-
actions
Description copied from interface:IEntityAll registered actions of this entity. -
perform
Description copied from interface:IEntityPerforms anEntityActionthat was previously registered for this entity.Does nothing in case no action has been registered for the specified
actionName. -
register
Description copied from interface:IEntityRegisters anEntityActionwith the specified name. It's later possible to execute these actions on the entity by using theEntity.perform(String actionName)method. -
sendMessage
- Specified by:
sendMessagein interfaceIEntity
-
setHeight
public void setHeight(double height) -
setLocation
public void setLocation(double x, double y) - Specified by:
setLocationin interfaceIEntity
-
setLocation
Sets the map location.- Specified by:
setLocationin interfaceIEntity- Parameters:
location- the new map location
-
setMapId
public void setMapId(int mapId) Sets an id which should only be filled when an entity gets added due to map information. -
setName
-
setRenderType
- Specified by:
setRenderTypein interfaceIEntity
-
setSize
public void setSize(double width, double height) -
setWidth
public void setWidth(double width) -
setX
public void setX(double x) -
setY
public void setY(double y) -
getTags
-
hasTag
-
addTag
-
removeTag
-
getTweenValues
Description copied from interface:TweenableGets one or many values from the target object associated to the given tween type. It is used by the Tween Engine to determine starting values.- Specified by:
getTweenValuesin interfaceTweenable- Parameters:
tweenType- The tween type of this interpolation, determining which values are modified.- Returns:
- The array of current tween values.
-
setTweenValues
Description copied from interface:TweenableThis method is called in a Tween's update() method to set the new interpolated values.- Specified by:
setTweenValuesin interfaceTweenable- Parameters:
tweenType- The tween type of this interpolation, determining which values are modified.newValues- The new values determined by the tween equation.
-
setAngle
public void setAngle(double angle) Description copied from interface:IEntitySets the angle (in degrees) in which the entity is directed. -
toString
-
getEnvironment
Description copied from interface:IEntityGets the environment the entity was loaded to or null if it is not loaded.- Specified by:
getEnvironmentin interfaceIEntity- Returns:
- The entity's environment.
-
loaded
Description copied from interface:IEntityThis method provides the possibility to implement behavior whenever this entity was added to the environment. -
removed
Description copied from interface:IEntityThis method provides the possibility to implement behavior whenever this entity was removed from the environment. -
isLoaded
public boolean isLoaded()Description copied from interface:IEntityIndicates whether this entity is loaded on the currently active environment. -
renderWithLayer
public boolean renderWithLayer()Description copied from interface:IEntityDetermines whether this entity is being rendered with the layer it's originating from. This ignores the specifiedRenderTypeand makes the entity dependent upon the visibility of it's layer.This can only be used, of course, if the entity is related to a
MapObject.
This defaults tofalseif not explicitly set on theMapObject.- Specified by:
renderWithLayerin interfaceIEntity- Returns:
- True if the entity should be rendered with the layer of the corresponding map object; otherwise false.
- See Also:
-
setRenderWithLayer
public void setRenderWithLayer(boolean renderWithLayer) - Specified by:
setRenderWithLayerin interfaceIEntity
-
rendering
Description copied from interface:EntityRenderListenerThis method gets called after all rendering checks have successfully passed and right before the entity is about to be rendered.- Specified by:
renderingin interfaceEntityRenderListener- Parameters:
event- The event that contains the render data.
-
rendered
Description copied from interface:EntityRenderedListenerThis method gets called after an entity was rendered.- Specified by:
renderedin interfaceEntityRenderedListener- Parameters:
event- The event that contains the render data.
-
canRender
Description copied from interface:EntityRenderListenerThis method gets called before anEntityis about to be rendered. Returning false prevents the rendering of the specified entity.- Specified by:
canRenderin interfaceEntityRenderListener- Parameters:
entity- The entity to be rendered.- Returns:
- True if the entity should be rendered; otherwise false.
-
getControllers
-