Wall Jumping

Version:

1.0

Added on:

21 Oct 2013 22:25

Tags:

No tags added for this snippet.

Description:
Lets you jump from walls and slide down on them.
How to use: Press a directoinal button towards a wall to slide down on it slowly. Press jump while sliding to jump.
/**MegaMan X style WallJump**/
/**Author: szmol96**/

int jumpKey = 0;

void onMain() {
  jjPLAYER@ p = jjLocalPlayers[0];
  p.ammo[2] = 3;
  if (p.keyJump == true) {
    jumpKey = jumpKey+1;
  } else {
    jumpKey = 0;
  }
  
  if (jjMaskedPixel(p.xPos + (p.direction * 13), p.yPos) && p.keyJump == true && jumpKey < 3) {
    p.ySpeed = -10;
    p.direction = p.direction * (-1);
    p.xSpeed = p.direction * 5;
//    && p.ySpeed < 0 
  }
  
  if (jjMaskedPixel(p.xPos + 13, p.yPos)  && p.ySpeed > 0 && p.keyRight == true) {
    p.ySpeed = 1;
    p.alreadyDoubleJumped = false;
  }
  if (jjMaskedPixel(p.xPos - 13, p.yPos)  && p.ySpeed > 0 && p.keyLeft == true) {
    p.ySpeed = 1;
    p.alreadyDoubleJumped = false;
  }
}