Make 2 movieclips follow mouse? AS2
- MichaelJ
-
MichaelJ
- Member since: Mar. 2, 2009
- Offline.
-
- Forum Stats
- Member
- Level 18
- Voice Actor
Is there a way to make 2 separate movie clips follow the mouse that are on different layers?
You see, there is a custom cursor in my game, and when you go into the dark rooms a flashlight effect movie clip should follow the mouse along with the main cursor, but since the cursor is OVER the interface and the light effect is UNDER the interface, I need to make them separate (the cursor and the light effect).
I can't have the light effect go over the interface, but i cant have the cursor go under the interface, but I need them both to follow the mouse simultaneously! Please help! ----AS2
- swishcheese
-
swishcheese
- Member since: May. 12, 2007
- Offline.
-
- Forum Stats
- Member
- Level 14
- Programmer
At 4/3/11 06:42 PM, Animator1mike wrote: Is there a way to make 2 separate movie clips follow the mouse that are on different layers?
You see, there is a custom cursor in my game, and when you go into the dark rooms a flashlight effect movie clip should follow the mouse along with the main cursor, but since the cursor is OVER the interface and the light effect is UNDER the interface, I need to make them separate (the cursor and the light effect).
I can't have the light effect go over the interface, but i cant have the cursor go under the interface, but I need them both to follow the mouse simultaneously! Please help! ----AS2
sure, being on different layers doesnt change anything:
this.onEnterFrame = function(){
mc1._x = _root._xmouse;
mc1._y = _root._ymouse;
mc2._x = _root._xmouse;
mc2._y = _root._ymouse;
}
- MichaelJ
-
MichaelJ
- Member since: Mar. 2, 2009
- Offline.
-
- Forum Stats
- Member
- Level 18
- Voice Actor
- Spysociety
-
Spysociety
- Member since: Dec. 30, 2009
- Offline.
-
- Forum Stats
- Member
- Level 21
- Blank Slate
Do you want to the movieclips be dragger or follow the mouse? If you really want to they follow, do this:
if these codes were typed inside a movieclip which the movieclips will follow:
_root.instance._x+=(_root._xmouse-this._x)/5;
_root.instance._y+=(_root._ymouse-this._y)/5; - Spysociety
-
Spysociety
- Member since: Dec. 30, 2009
- Offline.
-
- Forum Stats
- Member
- Level 21
- Blank Slate


