Mario Koopa stationary problem

In a mario game I am programming, I cant get the koopa to stop moving after mario jumps on him. My code for his movement is below:


onClipEvent (enterFrame) {
if (this._xscale == 100) {
this._x -= 1;
}
if (this._xscale == -100) {
this._x += 1;
}
}

give the kupa a boolean variable that changes to true when mario jumps on him and then adjust your code slightly:


onClipEvent (enterFrame) {
if(!this.flattened) {
if (this._xscale == 100) {
this._x -= 1;
}
if (this._xscale == -100) {
this._x += 1;
}
}
}

Hope that helps.

Thanks, Ill try that :smiley:

SWEET! it worked! Thanks, Dude!

Another note, you can replace
this._x -= 1;
and
this._x += 1;

With
this._x++
and
this._x–

Oh, I didn’t know that!