In the paltform game tutorial on the site there is a jump code that works fine, but I was wondering if there was a way to make a smoother jump. So I did some research and ended up using gravity and friction to get the jump effect I wanted. Then I realized what I really was looking for is a way so that when you jump you can’t jump again in the air. Maybe like if spacebar key is down spacebar can’t be pressed again. Can someone please help me with this?
Code on the site:
if (speed<1 && speed>-1 && !attacking) {<br>
speed = 0;<br>
this.gotoAndStop(“idle”);<br>
}<br>
if (Key.isDown(Key.UP) && !jumping) {<br>
jumping = true;<br>
}<br>
if (jumping) {<br>
this.gotoAndStop(“jump”);<br>
this._y -= jump;<br>
jump -= .5;<br>
if (jump<0) {<br>
falling = true;<br>
}
if (jump<-15) {<br>
jump = -15;<br>
}<br>
}<br>
Sorry for the <br>'s I don’t know how to post actionscript on this forum without it getting all messed up.