Add game over screen

This commit is contained in:
James Skemp 2024-01-07 09:39:05 -06:00
parent e283d03ca4
commit d09a59a55d
2 changed files with 34 additions and 0 deletions

View File

@ -15,3 +15,8 @@ func spawn_mob():
func _on_timer_timeout():
spawn_mob()
func _on_player_health_depleted():
(%GameOver as CanvasLayer).visible = true
get_tree().paused = true

View File

@ -55,4 +55,33 @@ position = Vector2(1492, 530)
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.709804)
[node name="Label" type="Label" parent="GameOver/ColorRect"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -43.5
offset_top = -11.5
offset_right = 43.5
offset_bottom = 11.5
grow_horizontal = 2
grow_vertical = 2
theme_override_font_sizes/font_size = 200
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"]