How rotate a sprite following the mouse?

Hi.
I’m trying to find a way that a sprite rotate about itself following the direction of the mouse but I don’t get it. I hope you can help me, thanks in advance.
I Intend to what an object is and move in direction to the mouse pointer.

PD: Excuse me for my bad english

You can find the action at:
All Objects->Angle->Rotate toward position

Enter the name of the object you want to rotate, for X position enter MouseX() for Y position enter MouseY() and for Angular speed enter 100.

If you have trouble with this, on the top go to the events store and use the rotate object toward mouse event.

You can also read this tutorial which is very useful :
wiki.compilgames.net/doku.php/gd … rtutorial2

Hello again I served much your help, now I have a new little problem, the sprite turns looking at the mouse pointer but does not look in the position that I’m looking for, I mean, I want that points toward the mouse to be head of the ship instead of the right-wing attempt that will be visible in the image.

Make sure your ship is facing to the right on the image as in GDevelop the right side of the image is the default direction.
ship.png

Omg! I love you. I just had to turn the sprite like you said.
Thaks for all

Hello,

Happy new year to whomever is reading !! :slight_smile:

I am new to GD, I hope I am using the right topic.
Does anyone know how to get the angular speed of the sprite once it is rotating thanks to the mouse ?

I have tried to use Physics and angular velocity but it is not working, please find my event below

Thanks a lot in advance

Raise your question as a new thread. This one is over 5 years old, and you shouldn’t piggy back a thread that’s not about the same thing

Also, it’s more likely someone will respond, and if others search for a similar issue in future, there’s more chance they’ll come across this one :slight_smile:

Thank you, new thread created : How to get Angular speed from a sprite rotating thanks to the mouse?

1 Like