Class GravityForce
java.lang.Object
de.gurkenlabs.litiengine.physics.Force
de.gurkenlabs.litiengine.physics.GravityForce
GravityForce is a gravitational force pulling entities towards a given direction or angle.
-
Constructor Summary
ConstructorsConstructorDescriptionGravityForce(IEntity forceEntity, float strength, float angle) Instantiates a new GravityForce.GravityForce(IEntity forceEntity, float strength, Direction direction) Instantiates a new GravityForce. -
Method Summary
Modifier and TypeMethodDescriptionGets the entity on which the gravitational force is applied.Calculates and returns the location where the gravitational force is applied.Methods inherited from class de.gurkenlabs.litiengine.physics.Force
cancelOnCollision, cancelOnReached, end, getIdentifier, getStrength, hasEnded, hasReached, setCancelOnCollision, setCancelOnReached, setIdentifier, setLocation, setStrength, toString
-
Constructor Details
-
GravityForce
-
GravityForce
Instantiates a new GravityForce.- Parameters:
forceEntity- The entity on which the gravitational force is applied.strength- The strength of the gravitational force.angle- The angle at which the gravitational force is applied.
-
-
Method Details
-
getForceEntity
Gets the entity on which the gravitational force is applied.- Returns:
- The force entity.
-
getLocation
Calculates and returns the location where the gravitational force is applied. This location is calculated by projecting the force onto a point based on the entity's center, angle, and strength.- Overrides:
getLocationin classForce- Returns:
- The location where the gravitational force is applied.
-