0

I have this example of hw to make a movie clip follow the mouse by using the
current position of the mouse (_Mousex and _mousey)...but now i wnt the movie clip to
go the opposite direction of the mouse..4 e.g if the mouse is @ Y=5 and X=2 then the movie clip 2
b @ Y=-5 and X=-2...is there a way of doing this,thanx

3
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by rajarajan07
0

I'm not sure I got your question, but I guess it's simple...
0 - mouseX
0 - mouseY
By the way, you are using an old version of AS

0

Thanx bt i hv tried it n it dsnt work...pls try it n c if it works coz i might b making a small mistake.

0

i have this code

onClipEvent (load)
{
//current position of the movie clip
this._x = 0;
this._y = 0;
//speed
var speed = 20;
}
onClipEvent (enterFrame)
{
//position of the movie clip =position of the mouse -prev position of the movie clip at that speed
_x =- (_xmouse - _x)/speed;
_y =- (_ymouse - _y)/speed;
}

it seems to work but the movie clip goes 2 the top left corner n stucks there,i want it 2 b in the middle..pls help ,thanx 4 replying

0

The below code will work

onClipEvent (load)
{
	var speed = 10;
} 

onClipEvent (enterFrame)
{
//position of the movie clip =position of the mouse -prev position of the movie clip at that speed
_x = -(_xmouse - this._x)/speed;
_y = -(_ymouse - this._y)/speed;
_x+=200;
_y+=100;
}
0

The below code will work

onClipEvent (load)
{
	var speed = 10;
} 

onClipEvent (enterFrame)
{
//position of the movie clip =position of the mouse -prev position of the movie clip at that speed
_x = -(_xmouse - this._x)/speed;
_y = -(_ymouse - this._y)/speed;
_x+=200;
_y+=100;
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.