Step by step - Listening to player input
This commit is contained in:
parent
8235939bf3
commit
6240748512
1 changed files with 11 additions and 3 deletions
|
@ -4,8 +4,16 @@ var speed = 400
|
|||
var angular_speed = PI
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
rotation += angular_speed * delta
|
||||
|
||||
var velocity = Vector2.UP.rotated(rotation) * speed
|
||||
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
|
||||
|
||||
position += velocity * delta
|
||||
|
|
Loading…
Reference in a new issue