hey, i’m working on this simple game and i’m using some code i found on another post to make my character jump…but he won’t stop jumping…it’s just continuous…
can anyone take a look at this and tell me whY?
hey, i’m working on this simple game and i’m using some code i found on another post to make my character jump…but he won’t stop jumping…it’s just continuous…
can anyone take a look at this and tell me whY?
Can you post your code? I can’t download from work… sounds almost like you either need a “stop();” somewhere, or an if/else statement to tell it when NOT to jump…
[AS]
onClipEvent(load) {
var jumping = false;
var speed_y = 15;
}
onClipEvent(enterFrame) {
if(key.isDown(Key.RIGHT)) {
this._x +=5;
this.gotoAndStop(“right”);
}
else if(key.isDown(Key.LEFT)) {
this._x -=5;
this.gotoAndStop(“left”);
}
else {
this.gotoAndStop(“idle”);
}
// jump
if(key.isDown(Key.SPACE) && !jumping) {
jumping = true;
}
if(jumping = true) {
this._y -= speed_y;
speed_y–;
}
if (this.hitTest(_root.floor)) {
jumping = false;
speed_y = 15;
}
}
[/AS]
if(jumping == true) {
this._y -= speed_y;
speed_y--;
}
you have = in your if but it should be ==
= asign variable
== test variable
doh, thanks…i always fall victim to the silly mistakes
:: Copyright KIRUPA 2024 //--