Try adding the following after line 9:
elif angle == 89:
angle = 0
else:
print("angle out of range on KinematicBody2D")
Ah, or if you want to do the same thing backwards you could do this:
extends KinematicBody2D
var additive = true
var angle = 0
onready var label = $Label
func get_input():
if Input.is_action_pressed("f"):
if angle <= 88 and additive:
angle += 1
if angle == 89 and additive:
additive = false
elif angle >= 1 and !additive:
angle -= 1
if angle == 0 and !additive:
additive = true
else:
print("Angle is out of range on KinematicBody2D")
func _physics_process(delta: float) -> void:
get_input()
clamp(angle, 0, 89)
label.text = str(angle)
edit: forgot to add the state change. :tongue: