90 degrees rotation of Sqaure(Area2D) when clicking

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Krippi

Hey, so I want that when I press the right arrow button, my player a rectangle (Area2D) rotates by 90 degrees. If the left arrow button is pressed, the player should rotate by -90 degrees. However, it should exactly turn to 90 180 270 360 450 … degrees, otherwise the rectangle will not have straight lines.
Currently I have:

func _process(delta):
print($Player.rotation)
if rotate_to > $Player.get_rotation_degrees():
	$Player.rotate((1 * delta)) ##### $Player.rotate((1 * delta) * speed)
	abc = true
elif abc == true:
	abc = false
	$Player.set_rotation_degrees(int($Player.get_rotation_degrees())) 
elif $Player.get_rotation_degrees() >= 360.0:
	$Player.set_rotation_degrees(0)
	rotate_to = 0
print($Player.get_rotation_degrees())
func _input(event):
if Input.is_key_pressed(KEY_RIGHT) and not event.is_echo():
	rotate_to += 90

This works fine, but when i want to add a speed var, to make it faster, it breaks.