JavaScript is disabled on your browser.
Method Summary
All Methods Instance Methods Abstract Methods
boolean
void
Triggers a collision event for this entity.
Retrieves the horizontal alignment of the entity's collision box.
Gets the center
Point2D of the entities collision box.
double
Retrieves the height of the entity's collision box.
Retrieves the vertical alignment of the entity's collision box.
double
Retrieves the width of the entity's collision box.
Retrieves the collision type of this entity.
boolean
Checks if the entity has collision enabled.
void
void
void
Sets the collision state of the entity.
void
Sets the horizontal alignment of the entity's collision box.
void
Sets the height of the entity's collision box.
void
Sets the vertical alignment of the entity's collision box.
void
Sets the width of the entity's collision box.
void
Sets the collision type of this entity.
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
onCollision
Parameters:
listener - The CollisionListener to be added to this entity. It should not be null.
removeCollisionListener
Removes a previously registered
CollisionListener from this entity. After removal, the listener will no longer receive collision events
involving this entity.
Parameters:
listener - The CollisionListener to be removed. It should match a listener that was previously added with
onCollision(CollisionListener) .
fireCollisionEvent
Triggers a collision event for this entity. This method is used to manually fire a collision event, which can be useful for custom collision
handling or for simulating collisions in specific scenarios.
Parameters:
event - The CollisionEvent that encapsulates the details of the collision. This includes information such as the entities involved
in the collision and the collision's impact point.
canCollideWith
Determines if this entity can collide with another specified
ICollisionEntity. This method should be implemented to define custom
collision logic between entities.
Parameters:
otherEntity - The other ICollisionEntity to check collision capability with.
Returns:
true if this entity can collide with the specified entity; false otherwise.
getCollisionBox
Gets the collision box.
Returns:
the collision box
getCollisionBox
Gets the collision box.
Parameters:
location - the location
Returns:
the collision box
getCollisionBoxCenter
Gets the center
Point2D of the entities collision box.
Returns:
The center Point2D of the entities collision box
getCollisionBoxValign
Valign getCollisionBoxValign ()
Retrieves the vertical alignment of the entity's collision box. This alignment determines the vertical positioning of the collision box relative
to the entity's location.
Returns:
The Valign representing the vertical alignment of the collision box.
getCollisionBoxAlign
Align getCollisionBoxAlign ()
Retrieves the horizontal alignment of the entity's collision box. This alignment determines the horizontal positioning of the collision box
relative to the entity's location.
Returns:
The Align representing the horizontal alignment of the collision box.
getCollisionType
Retrieves the collision type of this entity. The collision type defines how this entity interacts with other entities in terms of physical
collisions.
Returns:
The Collision type of this entity, indicating how it should be treated in collision detection and handling.
getCollisionBoxHeight
double getCollisionBoxHeight ()
Retrieves the height of the entity's collision box. This height is used in collision detection to determine the vertical bounds of the entity.
Returns:
The height of the collision box in pixels.
getCollisionBoxWidth
double getCollisionBoxWidth ()
Retrieves the width of the entity's collision box. This width is used in collision detection to determine the horizontal bounds of the entity.
Returns:
The width of the collision box in pixels.
hasCollision
boolean hasCollision ()
Checks if the entity has collision enabled.
Returns:
true if the entity has collision enabled; false otherwise.
setCollision
void setCollision (boolean collision)
Sets the collision state of the entity.
Parameters:
collision - The collision state to set. true to enable collision; false to disable it.
setCollisionBoxHeight
void setCollisionBoxHeight (double collisionBoxHeight)
Sets the height of the entity's collision box.
Parameters:
collisionBoxHeight - The height of the collision box in pixels.
setCollisionBoxWidth
void setCollisionBoxWidth (double collisionBoxWidth)
Sets the width of the entity's collision box.
Parameters:
collisionBoxWidth - The width of the collision box in pixels.
setCollisionBoxAlign
void setCollisionBoxAlign (Align align)
Sets the horizontal alignment of the entity's collision box.
Parameters:
align - The Align representing the horizontal alignment of the collision box.
setCollisionBoxValign
void setCollisionBoxValign (Valign valign)
Sets the vertical alignment of the entity's collision box.
Parameters:
valign - The Valign representing the vertical alignment of the collision box.
setCollisionType
void setCollisionType (Collision collisionType)
Sets the collision type of this entity.
Parameters:
collisionType - The Collision type indicating how this entity should be treated in collision detection and handling.