yorkshirepuddin
November 20th, 2002, 11:08 PM
Hi there,
The last few days I have been trying to figure out how to constrain a MC that follows the mouse on the Y axis with no luck.
While I have certainly come across many threads on the matter, on many boards, every method of doing it (including the mouse follow) is different and adding to my confusion.
Here's the code I'm using, and by all means, if you know of something simplier, then let me know.
Okay, here it is:
onClipEvent (enterFrame) {
mousey = _root._Ymouse;
if (mousey<_y) {
followmouse = _y-mousey;
} else {
followmouse = mousey-_y;
}
moveSpeedx = followmouse/10;
if (mousey<_y) {
_Y = _Y-movespeedx;
} else {
_Y = _Y+movespeedx;
}
}
So, as I wanted this will follow my mouse. However, if the user was to go beyond the movie frame, I also lose the MC. I want to restrict it to a min of 20 and max of 230.
Can anyone help. I'm getting desparate here. Make me go to bed a happy girl.
Cheers. YP
The last few days I have been trying to figure out how to constrain a MC that follows the mouse on the Y axis with no luck.
While I have certainly come across many threads on the matter, on many boards, every method of doing it (including the mouse follow) is different and adding to my confusion.
Here's the code I'm using, and by all means, if you know of something simplier, then let me know.
Okay, here it is:
onClipEvent (enterFrame) {
mousey = _root._Ymouse;
if (mousey<_y) {
followmouse = _y-mousey;
} else {
followmouse = mousey-_y;
}
moveSpeedx = followmouse/10;
if (mousey<_y) {
_Y = _Y-movespeedx;
} else {
_Y = _Y+movespeedx;
}
}
So, as I wanted this will follow my mouse. However, if the user was to go beyond the movie frame, I also lose the MC. I want to restrict it to a min of 20 and max of 230.
Can anyone help. I'm getting desparate here. Make me go to bed a happy girl.
Cheers. YP