Hi,
I´m trying to make a Mc to move around the canvas according to the mouse position. The Mc follows the mouse on the _y coordinates.
Now I want to make it change position on the _x coordinates according to the mouse.
It´s working fine on the _xmouse position, but I´m not getting it to work in the _ymouse position. I´d like the Mc change position when the mouse is over a determined are on the stage.
Could anyone help?
This is the code I´m using
onClipEvent (load) {
this._x = 750;
//set original x
this._y = 420;
//set original y
divider = 5;
//speed
numx = this._x;
//numx is destination x
numy = this._y;
//numy is destination y
}
onClipEvent (enterFrame) {
if (_ymouse>700) {
numx = 732;
//set destination x
} else {
numx = 760;
//set destination x
}
}
onClipEvent (enterFrame) {
if (_xmouse>-230) {
numx = 732;
//set destination x
} else {
numx = 760;
//set destination x
}
x = numx-_x;
//setup variable named x
this._x += x/divider;
//see the x transition
//y=numy-_y; //setup variable named y
//this._y+=y/divider; //see the y transition
}
onClipEvent (load) {
_y = 0;
speed = 5;
}
onClipEvent (enterFrame) {
endY = _root._ymouse;
_y += (endY-_y)/speed;
}