Rotate to mouse position tutorial?

DrGlickertDrGlickert Member Posts: 1,135
edited November -1 in Working with GS (Mac)
I remember watching a rotate actor to mouse position (or touch position) but now I can't seem to find it. I've looked through weswog's, TSB's and the GSCookBook videos but can't seem to find it. Can someone please post it for me? Did I miss it or is it called something else? It was the one with the cannon...

Thanks.

Comments

  • HachikoHachiko Member Posts: 330
    In the actor you want to rotate do:
    if mouse is down
    change attribute self.rotation to vectorToAngle(mouse.x-self.position.x, mouse.y-self.position.y)

    Should work :)
  • DrGlickertDrGlickert Member Posts: 1,135
    Thanks Hachiko. But I also want to put a limit on how far it can rotate to the left and right...any thoughts on that part?
Sign In or Register to comment.