Created
June 2, 2013 20:23
-
-
Save j0z/5694831 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var float JumpForce; | |
var bool CanJump; | |
var int jumpTime; | |
exec function BeginJump() | |
{ | |
if(Physics == PHYS_Walking) | |
{ | |
jumpTime = 0; | |
Velocity.Z = 0; | |
JumpForce = 100; | |
CanJump = TRUE; | |
} | |
//This loop finishes regardless of whether the key is still held down or not. | |
if (jumpTime < 50 && JumpForce > 0) | |
{ | |
SetPhysics(PHYS_Flying); | |
CanJump = FALSE; | |
Velocity.Z = Velocity.Z + JumpForce; | |
JumpForce = JumpForce-jumpTime; | |
jumpTime = jumpTime + 1; | |
`log("jumpTime: "@jumpTime); | |
`log("Velocity Z: "@Velocity.Z); | |
`log("JumpForce: "@JumpForce); | |
BeginJump(); | |
} | |
EndJump(); | |
} | |
exec function EndJump() | |
{ | |
SetPhysics(PHYS_Falling); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment