hey, so I’ve posted a couple of questions about jumping lately, but before I attack the had part of only being able to jump so high, my question is, how do I stop the hero from jumping while in the air?
here is my code that determines the state of my touchingGround boolean:
if (_root.popeman, hitTest(_root.ground)) {
touchingGround = true;
} else {
touchingGround = false;
}
popeman is the hero, ground clip is exactly what it sounds like.
this is my simple jump code:
if (Key.isDown(Key.UP)){
grav = maxJump;
}
it works perfectly, but I can just hold the key, and when I let go it drops, easy peasy.
my question, to clarify is:
how can I have the initial key press only work once (or until the ground is hit again).
I tried
if (Key.isDown(Key.UP) && touchingGround = true){
grav = maxJump;
}
(any errors in the code are only here, i triple checked in Flash)
any help would be appreciated.