Sword Swinging Mechanic

Godot Version

4.7

Question

I wanna make a top down arena game in Godot and I want a sword swing mechanic like this, not exactly but similar(yes I did come from scratch)Sword follows the mouse and swings where mouse is.

Use look_at(get_global_mouse_position()) to rotate the sword.

And if you want the player sprite to face the cursor then this should work:

func _process(delta: float) -> void:
    if get_global_mouse_position().x < global_position.x:
        $player.flip_h = true
    else:
        $player.flip_h = false

So the Sword mechanic. Its a good mechanic for “slice and dice” type games but me personally, I recommend using different mechanics for other types of games that you would wanna make and I also can from scratch too. (Technically, I went from scratch to makecode to Godot)(Don’t know how this is off-topic)