public class PlayerPhysics extends PhysicsComponent
PhysicsComponent.AABB, PhysicsComponent.BoundingVolume, PhysicsComponent.Collision, PhysicsComponent.Sphere
Modifier and Type | Field and Description |
---|---|
boolean |
isJumping |
acceleration, boundingVolume, gravity, RECTANGULAR, SPHERE, x_Vel, y_Vel
Constructor and Description |
---|
PlayerPhysics(int minJumpHeight,
int maxJumpHeight,
float jumpTime,
float rightBorder,
float ground,
float x_Pos,
float y_Pos,
float scale)
initialises the players physics component
computes the jumpVelocities by using more intuitive parameters
|
Modifier and Type | Method and Description |
---|---|
float |
getEarlyJumpVelocity() |
float |
getJumpVelocity() |
void |
handlePhysics(GameObject object,
double elapsedTime)
updates the players position, checks for collisions and resolves them
|
getCollisionPoint, intersects, intersects, intersects, leapFrogIntegration, resolveSolidCollision
public PlayerPhysics(int minJumpHeight, int maxJumpHeight, float jumpTime, float rightBorder, float ground, float x_Pos, float y_Pos, float scale)
minJumpHeight
- the minimum height of a jumpmaxJumpHeight
- the maximum height of a jumpjumpTime
- the time for jumpingrightBorder
- the right border of the levelground
- the lower border of the levelx_Pos
- the x position of the playery_Pos
- the y position of the playerscale
- the players scale used to determine the bounding volumepublic void handlePhysics(GameObject object, double elapsedTime)
handlePhysics
in class PhysicsComponent
object
- the object to updateelapsedTime
- the elapsed time since the last updatepublic float getJumpVelocity()
public float getEarlyJumpVelocity()