com.b3dgs.lionengine.game
Class Gravity

java.lang.Object
  extended by com.b3dgs.lionengine.game.Gravity

public class Gravity
extends java.lang.Object

Gravity handler, for smoothed jump effect.


Constructor Summary
Gravity(Entity player)
          Create a new gravity.
 
Method Summary
 boolean canJump()
          Check if player is able to jump.
 void fall()
          Call to make object fall.
 float getMaxGainedY()
          Get the maxGainedY.
 float getSpeed()
          Get gravity speed.
 boolean isFalling()
          Get falling state.
 boolean isJumping()
          Get jumping state.
 boolean isUpping()
          Check if player is upping (differential y).
 void jump()
          Call to make object jump.
 void jump(float force)
          Call to make object jump with specified force.
 void setForces(float jumpForce, float fallForce)
          Set gravity forces.
 void setMaxGainedY(float maxGainedY)
          Set the maximum gainable height (maximum jump height).
 void setMinGainedY(float minGainedY)
          Set the minimum gainable height (minimum jump height).
 void stop()
          Call to stop process (ground reached).
 void update(float extrp)
          Update object gravity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Gravity

public Gravity(Entity player)
Create a new gravity.

Method Detail

update

public void update(float extrp)
Update object gravity.

Parameters:
extrp - extrapolation value.

jump

public void jump()
Call to make object jump.


jump

public void jump(float force)
Call to make object jump with specified force.

Parameters:
force - specified force.

fall

public void fall()
Call to make object fall.


stop

public void stop()
Call to stop process (ground reached).


canJump

public boolean canJump()
Check if player is able to jump.

Returns:
true if able to jump.

getSpeed

public float getSpeed()
Get gravity speed.

Returns:
gravity speed.

isJumping

public boolean isJumping()
Get jumping state.

Returns:
jumping state.

isUpping

public boolean isUpping()
Check if player is upping (differential y).

Returns:
upping state.

isFalling

public boolean isFalling()
Get falling state.

Returns:
falling state.

setForces

public void setForces(float jumpForce,
                      float fallForce)
Set gravity forces.

Parameters:
jumpForce - jump force.
fallForce - fall force.

setMinGainedY

public void setMinGainedY(float minGainedY)
Set the minimum gainable height (minimum jump height).

Parameters:
minGainedY - minimum jump height.

setMaxGainedY

public void setMaxGainedY(float maxGainedY)
Set the maximum gainable height (maximum jump height).

Parameters:
maxGainedY - minimum jump height.

getMaxGainedY

public float getMaxGainedY()
Get the maxGainedY.

Returns:
maxGainedY.