Add spaceship interaction components and update player movement logic

This commit is contained in:
2025-05-25 19:26:41 +02:00
parent 129fc17f13
commit bac0a8c5f7
19 changed files with 286 additions and 36 deletions

View File

@@ -6,7 +6,12 @@ extends Node
@export var bullet_spawn: Marker2D
@export var shoot_sfx: AudioStreamPlayer2D
var can_shoot: bool = true
var can_shoot: bool = false
func _ready() -> void:
set_process(false)
func _process(_delta: float) -> void:
@@ -30,4 +35,16 @@ func shoot() -> void:
can_shoot = false
await get_tree().create_timer(fire_rate).timeout
can_shoot = true
can_shoot = true
func on_ship_entered():
can_shoot = true
set_process(true)
func on_ship_exited():
can_shoot = false
set_process(false)
if shoot_sfx:
shoot_sfx.stop()