Package de.gurkenlabs.litiengine.physics
Interface IMovementController
- All Superinterfaces:
IEntityController
,IUpdateable
- All Known Implementing Classes:
GamepadEntityController
,KeyboardEntityController
,MousePathController
,MovementController
,PlatformingMovementController
public interface IMovementController
extends IEntityController
The Interface IMovementController is used for moving entities by applying forces to them.
Method Summary
Modifier and Type Method Description void
apply(Force force)
Apply the force to the entity.java.util.List<Force>
getActiveForces()
Gets the active forces.float
getDx()
Gets the delta x for each horizontal movement.float
getDy()
Sets the delta y for each vertical movement.Force
getForce(java.lang.String identifier)
double
getMoveAngle()
double
getVelocity()
Get the current velocity.void
onMovementCheck(java.util.function.Predicate<IMobileEntity> predicate)
Checks given conditions before moving.void
setDx(float dx)
Gets the delta x for each horizontal movement.void
setDy(float dy)
Sets the delta y for each vertical movement.void
setVelocity(double velocity)
Sets the current velocity.Methods inherited from interface de.gurkenlabs.litiengine.entities.IEntityController
attach, detach, getEntity
Method Details
getDx
float getDx()Gets the delta x for each horizontal movement.- Returns:
- the dx
setDx
void setDx(float dx)Gets the delta x for each horizontal movement.- Parameters:
dx
- the new dx
getDy
float getDy()Sets the delta y for each vertical movement.- Returns:
- the dy
setDy
void setDy(float dy)Sets the delta y for each vertical movement.- Parameters:
dy
- the new dy
getVelocity
double getVelocity()Get the current velocity.- Returns:
- The current velocity.
setVelocity
void setVelocity(double velocity)Sets the current velocity.- Parameters:
velocity
- The velocity to set.
apply
Apply the force to the entity.- Parameters:
force
- the force being applied to the entity
getActiveForces
java.util.List<Force> getActiveForces()Gets the active forces.- Returns:
- the active forces
getForce
getMoveAngle
double getMoveAngle()onMovementCheck
Checks given conditions before moving.- Parameters:
predicate
- the conditions that need to apply before moving. If they don't apply, the entity won't be moved.