diff --git a/scenes/game.tscn b/scenes/game.tscn index e9bf209..80a6216 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -83,4 +83,35 @@ zoom = Vector2(2, 2) wait_time = 0.3 autostart = true +[node name="GameOver" type="CanvasLayer" parent="."] +unique_name_in_owner = true +visible = false + +[node name="ColorRect" type="ColorRect" parent="GameOver"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0, 0, 0, 0.780392) + +[node name="Label" type="Label" parent="GameOver"] +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -271.5 +offset_top = -68.5 +offset_right = 271.5 +offset_bottom = 68.5 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_colors/font_color = Color(0.992157, 0, 0, 1) +theme_override_colors/font_shadow_color = Color(1, 1, 0, 1) +theme_override_colors/font_outline_color = Color(1, 0, 1, 1) +theme_override_font_sizes/font_size = 100 +text = "Game Over" + +[connection signal="health_depleted" from="player" to="." method="_on_player_health_depleted"] [connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] diff --git a/scripts/game.gd b/scripts/game.gd index bf01387..7e957da 100644 --- a/scripts/game.gd +++ b/scripts/game.gd @@ -13,3 +13,8 @@ func spawn_mob(): func _on_timer_timeout() -> void: spawn_mob() + + +func _on_player_health_depleted() -> void: + %GameOver.visible = true + get_tree().paused = true