At 8/29/08 07:25 PM, 14hourlunchbreak wrote:
Like this?
onClipEvent (load) {
speed = 10;
stop();
}
onClipEvent (enterFrame) {
gotoAndStop(1);
if (Key.isDown(Key.RIGHT)) {
_x += speed;
xdir = 1.0;
ydir = 0.0;
gotoAndPlay(2);
}
else if (Key.isDown(Key.LEFT)) {
_x -= speed;
xdir = -1.0;
ydir = 0.0;
gotoAndPlay(3);
}
Replace 1 with the frame number (inside your movieclip) that has the still pic on it. Replace 2 and 3 with the beginning keyframe that your running sequences are on.
i do what you said, but, when i use this code:
onClipEvent (enterFrame) {
gotoAndStop(1);
it freezes, i mean, mario don't walk, he move to the right, but the movie clip doesn't work, then, i use this code:
onClipEvent(load){
speed = 5;
stop();
}
onClipEvent(enterFrame){
if(Key.isDown(Key.RIGHT)){
this._x += speed;
xdir = 1.0;
ydir = 0.0;
this.gotoAndStop(2);
}
else if(Key.isDown(Key.LEFT)){
this._x -= speed;
xdir = -1.0;
ydir = 0.0;
this.gotoAndStop(4);
}
else {
this.gotoAndStop(1);
}
}
anyway, i can't do mario look to the left side :( , he always look to the right when he is still, but, i don't understand this codes:
xdir = 1.0;
ydir = 0.0;
what do those codes?