From bbeb63cc62d3fbacf4c5f6fafe4337c7f559f348 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 26 Mar 2024 10:53:32 +0100 Subject: [PATCH] Add my own part to move backwards on down --- scripting_first_script/Sprite2D.gd | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripting_first_script/Sprite2D.gd b/scripting_first_script/Sprite2D.gd index dde6e6e..7c0f258 100644 --- a/scripting_first_script/Sprite2D.gd +++ b/scripting_first_script/Sprite2D.gd @@ -11,8 +11,10 @@ func _process(delta): direction = +1 rotation += angular_speed * direction * delta - var velocity = Vector2.ZERO + var velocity = Vector2.UP.rotated(rotation) * speed if Input.is_action_pressed('ui_up'): - velocity = Vector2.UP.rotated(rotation) * speed + position += velocity * delta + + if Input.is_action_pressed('ui_down'): + position -= velocity * delta - position += velocity * delta