2025-06-07 16:13:21 +10:00
|
|
|
extends RigidBody2D
|
|
|
|
|
|
2025-06-27 16:39:28 +10:00
|
|
|
signal moved
|
2025-07-20 17:33:13 +10:00
|
|
|
signal got_hit
|
2025-11-30 00:49:23 +11:00
|
|
|
signal got_points
|
|
|
|
|
|
2025-06-27 16:39:28 +10:00
|
|
|
|
2025-06-07 16:13:21 +10:00
|
|
|
@export var thrust_power : float = 1
|
|
|
|
|
@export var turn_power : float = 1
|
2025-06-27 16:39:28 +10:00
|
|
|
@export var particles_l : CPUParticles2D
|
|
|
|
|
@export var particles_r : CPUParticles2D
|
2025-06-07 16:13:21 +10:00
|
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
|
func _ready() -> void:
|
|
|
|
|
pass # Replace with function body.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
|
|
|
func _process(delta: float) -> void:
|
2025-06-27 16:39:28 +10:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
func _physics_process(delta: float) -> void:
|
2025-06-07 16:13:21 +10:00
|
|
|
var turning : float = Input.get_axis("turn_left","turn_right") * turn_power
|
|
|
|
|
var thrust : float = Input.get_action_strength("thrust") * thrust_power
|
2025-06-27 16:39:28 +10:00
|
|
|
particles_l.emitting = thrust != 0
|
|
|
|
|
particles_r.emitting = thrust != 0
|
|
|
|
|
if Input.is_action_just_pressed("thrust"):
|
|
|
|
|
moved.emit()
|
|
|
|
|
#pass
|
2025-06-07 16:13:21 +10:00
|
|
|
apply_torque(turning)
|
|
|
|
|
apply_force(Vector2(-thrust,-thrust) * transform.y )
|