How do i make the player flip towards the mouse direction?
heres what i tried but it doesnt work.
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