From dcda5a30b9f78f03bb86a320607cf25d8968a6f7 Mon Sep 17 00:00:00 2001 From: Dragos Stefan Cirstian Date: Fri, 5 Jul 2024 12:51:30 +0300 Subject: [PATCH] Add Ziua2:Miscari caracter 2 --- Ziua2:Miscari caracter 2 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Ziua2:Miscari caracter 2 diff --git a/Ziua2:Miscari caracter 2 b/Ziua2:Miscari caracter 2 new file mode 100644 index 0000000..bdf0964 --- /dev/null +++ b/Ziua2:Miscari caracter 2 @@ -0,0 +1,23 @@ +Cum procesam datele oferite de la tastatura // continuare joc zi anterioara + +extends Sprite2D +var speed = 400 +var angular_speed = PI + +func _process(delta): + var direction = 0 + if Input.is_action_pressed("ui_left"): + direction = -1 + if Input.is_action_pressed("ui_right"): + direction = 1 + + rotation += angular_speed * direction * delta + + var velocity = Vector2.ZERO + if Input.is_action_pressed("ui_up"): + velocity = Vector2.UP.rotated(rotation) * speed + + if Input.is_action_pressed("ui_down"): + velocity = Vector2.DOWN.rotated(rotation) * speed + + position += velocity * delta \ No newline at end of file