Skip to content

Instantly share code, notes, and snippets.

@Tmeister
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tmeister/9648242 to your computer and use it in GitHub Desktop.
Save Tmeister/9648242 to your computer and use it in GitHub Desktop.
Hero Jumping
public function update():void
{
if( _isJumping )
{
this.y -= ( jumpPower - gravity);
jumpPower -= 2;
if(this.y + gravity > groundBase)
{
this.y = groundBase;
_isJumping = false;
jumpPower = 24;
changeState(RUN);
isFalling = false;
return;
}
if( this.y > currentY && !isFalling)
{
isFalling = true;
changeState(FALL);
}
currentY = this.y
}
if(_isCharging && jumpPower < 35)
{
jumpPower += .50;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment