PDA

View Full Version : Mario Koopa stationary problem



elPooter
July 8th, 2004, 07:01 PM
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;
}
}

jerez_z
July 8th, 2004, 07:27 PM
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.

elPooter
July 8th, 2004, 07:41 PM
Thanks, Ill try that :D

elPooter
July 8th, 2004, 07:43 PM
SWEET! it worked! Thanks, Dude!

GW02
July 8th, 2004, 09:09 PM
Another note, you can replace
this._x -= 1;
and
this._x += 1;

With
this._x++
and
this._x--

elPooter
July 9th, 2004, 12:03 AM
Oh, I didn't know that!