chore: fix warnings (?)

This commit is contained in:
installer
2025-01-22 19:05:53 +01:00
parent 3ef5356560
commit 52ce1d00c3
2 changed files with 8 additions and 7 deletions

View File

@@ -37,6 +37,10 @@ func _ready() -> void:
star.scale = Vector2(s, s); star.scale = Vector2(s, s);
get_tree().call_group("ui", "set_health", health); get_tree().call_group("ui", "set_health", health);
func _process(_delta: float) -> void:
if health <= 0:
get_tree().change_scene_to_file("res://scenes/game_over.tscn");
func _on_meteor_timer_timeout() -> void: func _on_meteor_timer_timeout() -> void:
$MeteorTimer.wait_time = Global.meteor_base_timer; $MeteorTimer.wait_time = Global.meteor_base_timer;
var meteor = meteor_scene.instantiate(); var meteor = meteor_scene.instantiate();
@@ -46,9 +50,6 @@ func _on_meteor_timer_timeout() -> void:
func _on_meteor_collision() -> void: func _on_meteor_collision() -> void:
health -= 1; health -= 1;
get_tree().call_group("ui", "set_health", health); get_tree().call_group("ui", "set_health", health);
if health <= 0:
get_tree().change_scene_to_file("res://scenes/game_over.tscn");
else:
$ShipHit.play(); $ShipHit.play();
func _on_player_laser(pos: Vector2) -> void: func _on_player_laser(pos: Vector2) -> void:

View File

@@ -29,7 +29,7 @@ func _process(delta) -> void:
func _on_body_entered(_body: Node2D) -> void: func _on_body_entered(_body: Node2D) -> void:
if can_collide: if can_collide:
collision.emit(); collision.emit();
queue_free(); call_deferred("queue_free");
func _on_area_entered(area: Area2D) -> void: func _on_area_entered(area: Area2D) -> void:
area.queue_free(); area.queue_free();
@@ -37,5 +37,5 @@ func _on_area_entered(area: Area2D) -> void:
Global.score += 10; Global.score += 10;
$MeteorImage.hide(); $MeteorImage.hide();
can_collide = false; can_collide = false;
await get_tree().create_timer(0.5).timeout; #await get_tree().create_timer(0.5).timeout;
queue_free(); call_deferred("queue_free");