Advertisement
Uhfgood

jump code

Nov 21st, 2015
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Haxe 0.47 KB | None | 0 0
  1. if ( this.vMotion == DO_JUMP )
  2. {
  3.     if ( this.canStartJump && this.onGround && this.isTouching( FlxObject.DOWN ) )
  4.     {
  5.         this.canStartJump = false;
  6.         this.canJump = true;
  7.         this.velocity.y = 0;
  8.         this.sounds[ "jump001" ].play();
  9.     }
  10.    
  11.     if ( this.canJump )
  12.     {
  13.         this.velocity.y -= this.maxVelocity.y / 16;
  14.         if ( this.velocity.y < -( this.maxVelocity.y / 2.3 ) )
  15.         {
  16.             this.canJump = false;
  17.         }
  18.     }
  19. }
  20. else
  21. {
  22.     this.canStartJump = true;
  23.     this.canJump = false;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement