How to stop and restart 2D rotatory motion in func _process(delta)

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

Hi,
How do I stop Sprite that is rotating through the func _process(delta)?

export var rotation_speed = PI

func _process(delta):
$Sprite.rotation += rotation_speed * delta

:bust_in_silhouette: Reply From: klaas

Hi,
make a flag

export var rotation_speed = PI
export var stop = false

func process(delta):
    if not stop:
        $Sprite.rotation += rotationspeed * delta

now you can set stop to true and it should stop its rotation