Hello all, and merry x-mas. I have a little problem with moving a movieclip
Here’s the code:
the button’s script:
on (press) {
_global.mouseXpos = _xmouse;
_global.mouseYpos = _ymouse;
_global.charXpos = myCharacter._x;
_global.charYpos = myCharacter._y;
// trace("Mouse X:"+mouseXpos+" Y:"+mouseYpos);
// trace("Character X:"+charXpos+" Y:"+charYpos);
if (mouseYpos>charYpos || mouseYpos<charYpos) {
_global.walk.Y = "true";
}
if (mouseXpos>charXpos || mouseXpos<charXpos) {
_global.walk.X = "pending";
}
}
and the movie’s script:
onClipEvent (enterFrame) {
if (walk.Y == "true") {
if (charYpos<mouseYpos) {
charYpos = charYpos+1;
this._y = charYpos;
} else if (charYpos>mouseYpos) {
charYpos = charYpos-1;
this._y = charYpos;
} else {
walk.Y = "false";
}
}
}
Maybe i can’t see the error cause i haven’t drunk enough coffee yet but… any kind of help would be appreciated. ^^