Class CollisionEntity
java.lang.Object
de.gurkenlabs.litiengine.entities.Entity
de.gurkenlabs.litiengine.entities.CollisionEntity
- All Implemented Interfaces:
EntityRenderedListener,EntityRenderListener,ICollisionEntity,IEntity,Tweenable,EventListener
- Direct Known Subclasses:
CollisionBox,CombatEntity,Trigger
-
Field Summary
Fields inherited from class de.gurkenlabs.litiengine.entities.Entity
ANY_MESSAGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanCollideWith(ICollisionEntity otherEntity) voidfireCollisionEvent(CollisionEvent event) Gets the collision box.getCollisionBox(Point2D location) Gets the collision box.static Rectangle2DgetCollisionBox(Point2D location, double entityWidth, double entityHeight, double collisionBoxWidth, double collisionBoxHeight, Align align, Valign valign) Gets the centerPoint2Dof the entities collision box.doubledoublefloat[]getTweenValues(TweenType tweenType) Gets one or many values from the target object associated to the given tween type.booleanChecks for collision.voidonCollision(CollisionListener listener) protected voidvoidremoveCollisionListener(CollisionListener listener) voidsetCollision(boolean collision) Sets the collision.voidsetCollisionBoxAlign(Align align) voidsetCollisionBoxHeight(double collisionBoxHeight) voidsetCollisionBoxValign(Valign valign) voidsetCollisionBoxWidth(double collisionBoxWidth) voidsetCollisionType(Collision type) voidsetHeight(double height) voidsetLocation(Point2D location) Sets the map location.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.voidsetWidth(double width) Methods 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
-
CollisionEntity
protected CollisionEntity()
-
-
Method Details
-
getCollisionBox
public static Rectangle2D getCollisionBox(Point2D location, double entityWidth, double entityHeight, double collisionBoxWidth, double collisionBoxHeight, Align align, Valign valign) -
canCollideWith
- Specified by:
canCollideWithin interfaceICollisionEntity
-
getCollisionBoxAlign
- Specified by:
getCollisionBoxAlignin interfaceICollisionEntity
-
getCollisionBox
Gets the collision box.- Specified by:
getCollisionBoxin interfaceICollisionEntity- Returns:
- the collision box
-
getCollisionBox
Gets the collision box.- Specified by:
getCollisionBoxin interfaceICollisionEntity- Parameters:
location- the location- Returns:
- the collision box
-
getCollisionBoxHeight
public double getCollisionBoxHeight()- Specified by:
getCollisionBoxHeightin interfaceICollisionEntity
-
getCollisionBoxWidth
public double getCollisionBoxWidth()- Specified by:
getCollisionBoxWidthin interfaceICollisionEntity
-
getCollisionBoxCenter
Description copied from interface:ICollisionEntityGets the centerPoint2Dof the entities collision box.- Specified by:
getCollisionBoxCenterin interfaceICollisionEntity- Returns:
- The center
Point2Dof the entities collision box
-
getCollisionBoxValign
- Specified by:
getCollisionBoxValignin interfaceICollisionEntity
-
getCollisionType
- Specified by:
getCollisionTypein interfaceICollisionEntity
-
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- Overrides:
getTweenValuesin classEntity- 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- Overrides:
setTweenValuesin classEntity- Parameters:
tweenType- The tween type of this interpolation, determining which values are modified.newValues- The new values determined by the tween equation.
-
hasCollision
public boolean hasCollision()Checks for collision.- Specified by:
hasCollisionin interfaceICollisionEntity- Returns:
- true, if successful
-
setCollision
public void setCollision(boolean collision) Sets the collision.- Specified by:
setCollisionin interfaceICollisionEntity- Parameters:
collision- the new collision
-
setCollisionBoxAlign
- Specified by:
setCollisionBoxAlignin interfaceICollisionEntity
-
setCollisionBoxHeight
public void setCollisionBoxHeight(double collisionBoxHeight) - Specified by:
setCollisionBoxHeightin interfaceICollisionEntity
-
setCollisionBoxValign
- Specified by:
setCollisionBoxValignin interfaceICollisionEntity
-
setCollisionBoxWidth
public void setCollisionBoxWidth(double collisionBoxWidth) - Specified by:
setCollisionBoxWidthin interfaceICollisionEntity
-
setLocation
Description copied from class:EntitySets the map location.- Specified by:
setLocationin interfaceIEntity- Overrides:
setLocationin classEntity- Parameters:
location- the new map location
-
setSize
public void setSize(double width, double height) -
setHeight
public void setHeight(double height) -
setWidth
public void setWidth(double width) -
setCollisionType
- Specified by:
setCollisionTypein interfaceICollisionEntity
-
onCollision
- Specified by:
onCollisionin interfaceICollisionEntity
-
removeCollisionListener
- Specified by:
removeCollisionListenerin interfaceICollisionEntity
-
fireCollisionEvent
- Specified by:
fireCollisionEventin interfaceICollisionEntity
-
refreshCollisionBox
protected void refreshCollisionBox()
-