How to make the player face the cursor?

How do i make the player flip towards the mouse direction?
heres what i tried but it doesnt work.
Screenshot 2024-12-14 13.11.40

X is the horizontal axis, so something like:

if CursorX() <= Player.CenterX() then flip horizontally Player: yes
if CursorX() > Player.CenterX() then flip horizontally Player: no
1 Like

oh, it was x before, but i was trying to see why its not working. but i didnt use player center, it works now, thanks

1 Like

When using SceneWindowWidth()/2 it would flip it if Cursor (assuming you’re using CursorX) goes over the half of the screen, but you need to compare with Player (center) X position. Also, assuming your player sprite is in the correct default orientation (facing right), you need to flip it when cursor position is “less than” (<) the Player center X, and you were trying with “greater than” comparison (>). Glad it works now!

1 Like

This would make more sense
Pay attention there is condition to check player X position
And to check player CENTER X position and this is which you should use