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