Topic was automatically imported from the old Question2Answer platform.
Asked By
elrico26
I occupy the character to turn vertically only according to the position of the mouse, so if the mouse is below the player it does not detect it, it only detects when it is to the right or to the left
I tried to make an animation according to the degrees of rotation and it went from a number of degrees to return to the stated amount but it gives many failures
In this example the character should be facing left if it’s a profile sprite.
If you want to gradually rotate you sprite looking at your mouse you could use the look_at() function in combination with get_global_mouse_position(). If you want to use this move the pivot of your sprite to where the rotation should occur.
For example:
If I have the sprite of an arrow and I want it to point towards the mouse I have to move the pivot of the arrow sprite to the base of the arrow.
Ready thanks bro, it helped me a lot
elrico26 | 2020-10-16 17:17
There is an error which says “The method “is_flipped_h” isn’t declared in the current class”
NARZ | 2021-03-16 19:32
Make sure you are using an sprite or an animatedsprite and that your script is extending one of these classes