Rotate towards mouse w/ boundaries and reflection

Hi there…

I’m using the code ‘rotate towards the mouse’ from http://moock.org/asdg/codedepot/

It works fine to rotate the clip, but there’s two things I’d like to have happen here:

  1. At a certain angle of rotation, the MC that is following the mouse reflects horizontally. example: a profile of a head is following the mouse. i don’t want the head to be upside down when the mouse reaches the back of the head, but rather the head flips over to watch the mouse.

  2. Boundaries: is there some way to set up the code so that the MC stops following the mouse when it reaches a certain position on the Y-axis?

I hope this is clear. Thanks for any help that can be provided.

I’m using Flash MX or MX 2k4, whichever is more convenient for this project.

anyone?!?!?!

if (_rotation < 0) _xscale = -100
else _xscale = 100

if (_y > value) _y = value

Other than that, you may need to provide more information

thanks for your help sen…it’s almost working, but not quite…

as you can see, the clip seems to be flipping on the wrong axis (i switched your code from xscale to yscale, and got slightly better results)…

also, i don’t know where i’m supposed to attach your 2) code…i understand it, but don’t really know where to put it.

here’s a rough example of what i’m working on. i want the head to look at the buttons on either side of his head (which aren’t actual buttons in this .fla, but you get the gist)…

thanks for the help… :slight_smile: