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.Object
Constructor 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 boolean
cancelOnCollision()
Cancel on collision.boolean
cancelOnReached()
void
end()
java.lang.String
getIdentifier()
java.awt.geom.Point2D
getLocation()
Gets the location.float
getStrength()
Gets the strength in pixels per second.boolean
hasEnded()
Checks for ended.boolean
hasReached(ICollisionEntity entity)
void
setCancelOnCollision(boolean cancelOnCollision)
void
setCancelOnReached(boolean cancelOnReached)
void
setIdentifier(java.lang.String identifier)
void
setLocation(java.awt.geom.Point2D location)
void
setStrength(float strength)
java.lang.String
toString()
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:
toString
in classjava.lang.Object