Commit f38a1933 authored by Tanner Grehawick's avatar Tanner Grehawick

wall jump

parent 625e59e9
......@@ -7,6 +7,8 @@ public class Jump : AbstractBehavior {
public float jumpHeight = 5;
public float airJumpHeight = 5;
public int airJumpCount = 1;
public float wallJumpHeight = 3;
public float wallJumpHorizontalSpeed = 5;
bool jumpRequested;
......@@ -32,6 +34,13 @@ public class Jump : AbstractBehavior {
vel.y = GetJumpVelocity(jumpHeight);
body.velocity = vel;
}
else if (collisionState.onWall) {
Vector2 vel = Vector2.up * GetJumpVelocity(wallJumpHeight);
if (collisionState.onWallLeft) { vel += Vector2.right * wallJumpHorizontalSpeed; }
if (collisionState.onWallRight) { vel -= Vector2.right * wallJumpHorizontalSpeed; }
print(vel);
body.velocity = vel;
}
else if (airJumpsMade < airJumpCount) {
Vector2 vel = body.velocity;
vel.y = GetJumpVelocity(airJumpHeight);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment