Finishing scripting_player_input section

This commit is contained in:
Daniel Siepmann 2024-03-26 10:35:08 +01:00
parent 6a7e1d0066
commit fc1fc0b784
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -4,8 +4,15 @@ var speed = 400
var angular_speed = PI var angular_speed = PI
func _process(delta): func _process(delta):
rotation += angular_speed * 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.UP.rotated(rotation) * speed var velocity = Vector2.ZERO
if Input.is_action_pressed('ui_up'):
velocity = Vector2.UP.rotated(rotation) * speed
position += velocity * delta position += velocity * delta