Be a Supporter!

Make 2 movieclips follow mouse? AS2

  • 1,128 Views
  • 4 Replies
New Topic Respond to this Topic
MichaelJ
MichaelJ
  • Member since: Mar. 2, 2009
  • Offline.
Forum Stats
Member
Level 18
Voice Actor
Make 2 movieclips follow mouse? AS2 2011-04-03 18:42:38 Reply

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


BBS Signature
swishcheese
swishcheese
  • Member since: May. 12, 2007
  • Offline.
Forum Stats
Member
Level 14
Programmer
Response to Make 2 movieclips follow mouse? AS2 2011-04-03 19:00:05 Reply

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;
}

BBS Signature
MichaelJ
MichaelJ
  • Member since: Mar. 2, 2009
  • Offline.
Forum Stats
Member
Level 18
Voice Actor
Response to Make 2 movieclips follow mouse? AS2 2011-04-03 19:04:49 Reply

Thank you!


BBS Signature
Spysociety
Spysociety
  • Member since: Dec. 30, 2009
  • Offline.
Forum Stats
Member
Level 21
Blank Slate
Response to Make 2 movieclips follow mouse? AS2 2011-04-03 19:49:57 Reply

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
Response to Make 2 movieclips follow mouse? AS2 2011-04-03 19:51:48 Reply

dragger

dragged

woops