How to make an actor rotate to follow mouse
Twisted Wire
Member, PRO Posts: 13
In my game I'm making I need to have a rectangle rotate to follow the direction of the mouse. This would drastically improve the gameplay, and it would be nice to get an answer ASAP. Thanks.
Comments
@TimeBombGames Here is a pic of how to do it (Change the rotate speed to what you want it to be)
Oh, sorry. In the first box is game.mouse.PositionX, and the second is game.mouse.PositionY, then in the third box it is the x again just raw
Hi @TimeBombGames and welcome to the Forums (and possibly GSC).
Here's a rather fine template made by @Tatiang in which you can use to apply to what you're after.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Everyone wants an answer ASAP so no need to mention that. I've never heard someone say "This is what I need help with but I'd like to wait a while before I get an answer."
More to the point, Constrain Attribute self.Rotation to vectorToAngle(game.Mouse.Position.X-self.Position.X, game.Mouse.Position.Y-self.Position.Y)
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thanks everyone, you've been a big help
Playing with this attribute is fun