onClipEvent (load) {
power = 0.6;
yspeed = 0;
xspeed = 0;
gravity = 0.1
jump = 0;
mass = 4; s
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
xspeed -= power;
}
if (Key.isDown(Key.RIGHT)) {
xspeed += power;
}
if (Key.isDown(Key.UP)) {
if (jump == 0) {
jump = 1;
yspeed = 8;
}
}
if (jump == 0) {
_y += yspeed;
yspeed += (gravity * mass);
}
else {
_y -= yspeed;
if (yspeed > 0) {
yspeed -= (gravity * mass);
}
else {
yspeed = 0;
jump = 0;
}
}
_x += xspeed;
if (_root.piso.hitTest(this._x, this._y, true)) {
yspeed = 0;
}
}
Problem description:
I want it to NOT jump when it is already jumping. Can someone help me please? Thanks :D