Trying to make a sword orbit around player following the cursor

4

I have a slightly working system after following a youtube tutorial on a gun orbiting the player but the sword is not facing the cursor when you move it as it is always at a offset angle which is different each time I open with a different cursor position, I am a very beginner programmer and was following GDquest’s survivor tutorial but I want to make a demon slayer game instead of having a gun.

Any help would be apricated,
Thanks,
Seb
2024-08-1415-28-31-ezgif.com-video-to-gif-converter

Can you try to do this instead:

look_at(get_global_mouse_position())
1 Like

Is your sword PNG facing to the right? The math for angles assumes facing the right is 0° or “forward” in 2D

1 Like

that has the same issue but definetly simplified my code a lot

yes

Yeah you probably need a offset by 90-degree. rotate the sprite or the tip by 90

2024-08-1419-18-44-ezgif.com-video-to-gif-converter

thanks that works perfectly

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.