Help with player Rotation

Godot 4.2.2

I’m having a problem here that I can’t make the player rotate towards (wasd) directions such as (w for up s for down d for right a for left) and once you press it, to make it face that direction without the requirement of you pressing it. Can someone help? (game is top down).

Can you show what code you have so far?

@gertkeno i have not used code but instead animations

Code is pretty good at solving these problems, I would recommend starting with a script and something along these lines

func _input(event: InputEvent) -> void:
    if event.is_action_pressed("up"):
        rotation_degrees = -90
    elif event.is_action_pressed("right"):
        rotation_degrees = 0

Thank you so much for your help! It worked.