Add game over screen
This commit is contained in:
parent
e283d03ca4
commit
d09a59a55d
5
game.gd
5
game.gd
|
@ -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
|
||||
|
|
29
game.tscn
29
game.tscn
|
@ -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"]
|
||||
|
|
Loading…
Reference in New Issue