From 9465faaf66a18b8b36459a3f9979cfd2d226bc00 Mon Sep 17 00:00:00 2001 From: Moe Poi ~ Date: Wed, 18 Oct 2023 11:14:33 +0700 Subject: [PATCH] Show defeat scene if current health less than 1 --- scripts/stages/1/game_manager.gd | 2 +- scripts/stages/2/game_manager.gd | 2 +- scripts/stages/3/game_manager.gd | 2 +- scripts/stages/4/game_manager.gd | 2 +- scripts/stages/5/game_manager.gd | 2 +- scripts/stages/6/game_manager.gd | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/stages/1/game_manager.gd b/scripts/stages/1/game_manager.gd index 55cc994..daedc8e 100644 --- a/scripts/stages/1/game_manager.gd +++ b/scripts/stages/1/game_manager.gd @@ -87,7 +87,7 @@ func on_enemy_entered_base(enemy): $CanvasLayer/GameStats.set_damage(enemy.damage) if data['health'] < 1: - print("Game Over") + get_tree().change_scene_to_file("res://scenes/ui/defeat.tscn") func on_enemy_reward(value: int): data['resource'] += value diff --git a/scripts/stages/2/game_manager.gd b/scripts/stages/2/game_manager.gd index e9b5691..e27f209 100644 --- a/scripts/stages/2/game_manager.gd +++ b/scripts/stages/2/game_manager.gd @@ -86,7 +86,7 @@ func on_enemy_entered_base(enemy): $CanvasLayer/GameStats.set_damage(enemy.damage) if data['health'] < 1: - print("Game Over") + get_tree().change_scene_to_file("res://scenes/ui/defeat.tscn") func on_enemy_reward(value: int): data['resource'] += value diff --git a/scripts/stages/3/game_manager.gd b/scripts/stages/3/game_manager.gd index 45b5bbc..4033aed 100644 --- a/scripts/stages/3/game_manager.gd +++ b/scripts/stages/3/game_manager.gd @@ -86,7 +86,7 @@ func on_enemy_entered_base(enemy): $CanvasLayer/GameStats.set_damage(enemy.damage) if data['health'] < 1: - print("Game Over") + get_tree().change_scene_to_file("res://scenes/ui/defeat.tscn") func on_enemy_reward(value: int): data['resource'] += value diff --git a/scripts/stages/4/game_manager.gd b/scripts/stages/4/game_manager.gd index 54a8892..315b8cb 100644 --- a/scripts/stages/4/game_manager.gd +++ b/scripts/stages/4/game_manager.gd @@ -86,7 +86,7 @@ func on_enemy_entered_base(enemy): $CanvasLayer/GameStats.set_damage(enemy.damage) if data['health'] < 1: - print("Game Over") + get_tree().change_scene_to_file("res://scenes/ui/defeat.tscn") func on_enemy_reward(value: int): data['resource'] += value diff --git a/scripts/stages/5/game_manager.gd b/scripts/stages/5/game_manager.gd index d9f0cbb..f642271 100644 --- a/scripts/stages/5/game_manager.gd +++ b/scripts/stages/5/game_manager.gd @@ -86,7 +86,7 @@ func on_enemy_entered_base(enemy): $CanvasLayer/GameStats.set_damage(enemy.damage) if data['health'] < 1: - print("Game Over") + get_tree().change_scene_to_file("res://scenes/ui/defeat.tscn") func on_enemy_reward(value: int): data['resource'] += value diff --git a/scripts/stages/6/game_manager.gd b/scripts/stages/6/game_manager.gd index 0384bff..a8f25ce 100644 --- a/scripts/stages/6/game_manager.gd +++ b/scripts/stages/6/game_manager.gd @@ -86,7 +86,7 @@ func on_enemy_entered_base(enemy): $CanvasLayer/GameStats.set_damage(enemy.damage) if data['health'] < 1: - print("Game Over") + get_tree().change_scene_to_file("res://scenes/ui/defeat.tscn") func on_enemy_reward(value: int): data['resource'] += value