Package de.gurkenlabs.litiengine.physics
Class Force
java.lang.Object
de.gurkenlabs.litiengine.physics.Force
- Direct Known Subclasses:
GravityForce,StickyForce
public class Force
extends java.lang.ObjectConstructor Summary
Constructors Constructor Description Force(java.awt.geom.Point2D location, float strength, float size)Instantiates a new force.Method Summary
Modifier and Type Method Description booleancancelOnCollision()Cancel on collision.booleancancelOnReached()voidend()java.lang.StringgetIdentifier()java.awt.geom.Point2DgetLocation()Gets the location.floatgetStrength()Gets the strength in pixels per second.booleanhasEnded()Checks for ended.booleanhasReached(ICollisionEntity entity)voidsetCancelOnCollision(boolean cancelOnCollision)voidsetCancelOnReached(boolean cancelOnReached)voidsetIdentifier(java.lang.String identifier)voidsetLocation(java.awt.geom.Point2D location)voidsetStrength(float strength)java.lang.StringtoString()
Constructor Details
Force
public Force(java.awt.geom.Point2D location, float strength, float size)Instantiates a new force.- Parameters:
location- The location where the force is originating fromstrength- The strength/intensity of this force instancesize- The size of this force (used to determine if/when an entity has reached the force)
Method Details
cancelOnCollision
public boolean cancelOnCollision()Cancel on collision.- Returns:
- true, if successful
cancelOnReached
public boolean cancelOnReached()end
public void end()getLocation
public java.awt.geom.Point2D getLocation()Gets the location.- Returns:
- the location
getStrength
public float getStrength()Gets the strength in pixels per second.- Returns:
- the strength in pixels per seconds
getIdentifier
public java.lang.String getIdentifier()hasEnded
public boolean hasEnded()Checks for ended.- Returns:
- true, if successful
hasReached
setCancelOnCollision
public void setCancelOnCollision(boolean cancelOnCollision)setCancelOnReached
public void setCancelOnReached(boolean cancelOnReached)setLocation
public void setLocation(java.awt.geom.Point2D location)setStrength
public void setStrength(float strength)setIdentifier
public void setIdentifier(java.lang.String identifier)toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
