Class CollisionBox
java.lang.Object
de.gurkenlabs.litiengine.entities.Entity
de.gurkenlabs.litiengine.entities.CollisionEntity
de.gurkenlabs.litiengine.entities.CollisionBox
- All Implemented Interfaces:
EntityRenderedListener,EntityRenderListener,ICollisionEntity,IEntity,Tweenable,EventListener
The
CollisionBox class represents a collision entity in the game. It extends the CollisionEntity class and provides additional
properties and methods specific to collision boxes.
This class is annotated with various annotations to define its behavior and properties in the game environment, such as rendering type, collision information, and map object type.
-
Field Summary
Fields inherited from class de.gurkenlabs.litiengine.entities.Entity
ANY_MESSAGE -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a newCollisionBoxentity.CollisionBox(boolean obstructingLight) Instantiates a newCollisionBoxentity.CollisionBox(double width, double height) Instantiates a newCollisionBoxentity.CollisionBox(double x, double y, double width, double height) Instantiates a newCollisionBoxentity.CollisionBox(Rectangle2D box) Instantiates a newCollisionBoxentity. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if this instance is obstructing light.Methods inherited from class de.gurkenlabs.litiengine.entities.CollisionEntity
canCollideWith, fireCollisionEvent, getCollisionBox, getCollisionBox, getCollisionBox, getCollisionBoxAlign, getCollisionBoxCenter, getCollisionBoxHeight, getCollisionBoxValign, getCollisionBoxWidth, getCollisionType, getTweenValues, hasCollision, onCollision, refreshCollisionBox, removeCollisionListener, setCollision, setCollisionBoxAlign, setCollisionBoxHeight, setCollisionBoxValign, setCollisionBoxWidth, setCollisionType, setHeight, setLocation, setSize, setTweenValues, setWidthMethods inherited from class de.gurkenlabs.litiengine.entities.Entity
actions, addController, addEntityRenderListener, addListener, addTag, addTransformListener, animations, attachControllers, behavior, canRender, detachControllers, getAngle, getBoundingBox, getCenter, getController, getControllers, 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, rendered, rendering, renderWithLayer, sendMessage, setAngle, setController, setLocation, setMapId, setName, setRenderType, setRenderWithLayer, setVisible, setX, setY, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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, setLocation, setMapId, setName, setRenderType, setRenderWithLayer, setVisible, setX, setY
-
Constructor Details
-
CollisionBox
public CollisionBox()Instantiates a newCollisionBoxentity. -
CollisionBox
public CollisionBox(boolean obstructingLight) Instantiates a newCollisionBoxentity.- Parameters:
obstructingLight- A flag indicating whether this instance should obstruct lights.
-
CollisionBox
public CollisionBox(double width, double height) Instantiates a newCollisionBoxentity.- Parameters:
width- The width of this instance.height- The height of this instance.
-
CollisionBox
public CollisionBox(double x, double y, double width, double height) Instantiates a newCollisionBoxentity.- Parameters:
x- The x-coordinate of this instance.y- The y-coordinate of this instance.width- The width of this instance.height- The height of this instance.
-
CollisionBox
Instantiates a newCollisionBoxentity.- Parameters:
box- The rectangle defining the location and dimension of this instnace.
-
-
Method Details
-
isObstructingLight
public boolean isObstructingLight()Checks if this instance is obstructing light.- Returns:
trueif this instance is obstructing light;falseotherwise.
-