Advertisement
Guest User

Untitled

a guest
Dec 16th, 2012
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. For all interessted people here, i have found a very simple and nice method to implement the jump function:
  2.  
  3. So, have fun with it and try the differet jump affects by changing the
  4. Ease(...)getInstance()  
  5. .
  6.  
  7. public static void jump()
  8. {
  9.         final float jumpDuration = 0.8f;
  10.         final int jumpHeight = 80;            
  11.         final float startY = Main.player.getY();
  12.         final float peakY = startY - jumpHeight;
  13.        
  14.         SequenceEntityModifier jumpModifier = new SequenceEntityModifier(
  15.                 new MoveYModifier(jumpDuration, startY, peakY, EaseQuadOut.getInstance()),
  16.                 new MoveYModifier(jumpDuration, peakY, startY, EaseBounceOut.getInstance()));
  17.        
  18. Main.player.registerEntityModifier(jumpModifier);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement