2024-03-26 10:35:08 +01:00
|
|
|
extends Sprite2D
|
|
|
|
|
|
|
|
var speed = 400
|
|
|
|
var angular_speed = PI
|
|
|
|
|
|
|
|
func _process(delta):
|
2024-03-26 10:35:08 +01:00
|
|
|
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
|
2024-03-26 10:35:08 +01:00
|
|
|
|
2024-03-26 10:53:32 +01:00
|
|
|
var velocity = Vector2.UP.rotated(rotation) * speed
|
2024-03-26 10:35:08 +01:00
|
|
|
if Input.is_action_pressed('ui_up'):
|
2024-03-26 10:53:32 +01:00
|
|
|
position += velocity * delta
|
|
|
|
|
|
|
|
if Input.is_action_pressed('ui_down'):
|
|
|
|
position -= velocity * delta
|
2024-03-26 10:35:08 +01:00
|
|
|
|