Class CollisionEntity
java.lang.Object
de.gurkenlabs.litiengine.entities.Entity
de.gurkenlabs.litiengine.entities.CollisionEntity
- All Implemented Interfaces:
EntityRenderedListener,EntityRenderListener,ICollisionEntity,IEntity,Tweenable,java.util.EventListener
- Direct Known Subclasses:
CollisionBox,CombatEntity,Trigger
public abstract class CollisionEntity
extends Entity
implements ICollisionEntityField Summary
Constructor Summary
Constructors Modifier Constructor Description protectedCollisionEntity()Method Summary
Modifier and Type Method Description booleancanCollideWith(ICollisionEntity otherEntity)voidfireCollisionEvent(CollisionEvent event)java.awt.geom.Rectangle2DgetCollisionBox()Gets the collision box.java.awt.geom.Rectangle2DgetCollisionBox(java.awt.geom.Point2D location)Gets the collision box.static java.awt.geom.Rectangle2DgetCollisionBox(java.awt.geom.Point2D location, double entityWidth, double entityHeight, double collisionBoxWidth, double collisionBoxHeight, Align align, Valign valign)AligngetCollisionBoxAlign()java.awt.geom.Point2DgetCollisionBoxCenter()Gets the centerPoint2Dof the entities collision box.doublegetCollisionBoxHeight()ValigngetCollisionBoxValign()doublegetCollisionBoxWidth()CollisiongetCollisionType()float[]getTweenValues(TweenType tweenType)Gets one or many values from the target object associated to the given tween type.booleanhasCollision()Checks for collision.voidonCollision(CollisionListener listener)protected voidrefreshCollisionBox()voidremoveCollisionListener(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(java.awt.geom.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
canCollideWith
- Specified by:
canCollideWithin interfaceICollisionEntity
getCollisionBoxAlign
- Specified by:
getCollisionBoxAlignin interfaceICollisionEntity
getCollisionBox
public java.awt.geom.Rectangle2D getCollisionBox()Gets the collision box.- Specified by:
getCollisionBoxin interfaceICollisionEntity- Returns:
- the collision box
getCollisionBox
public java.awt.geom.Rectangle2D getCollisionBox(java.awt.geom.Point2D location)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
public java.awt.geom.Point2D 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
public void setLocation(java.awt.geom.Point2D location)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()
