restart level call deferred
This commit is contained in:
parent
3247a67e96
commit
88b4135315
5 changed files with 20 additions and 21 deletions
|
@ -1,11 +1,5 @@
|
|||
extends Node2D
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
get_tree().paused = true
|
||||
|
@ -18,4 +12,8 @@ func _on_Resume_pressed():
|
|||
|
||||
|
||||
func _on_Restart_pressed():
|
||||
Game
|
||||
Game.call_deferred("restart_level")
|
||||
|
||||
|
||||
func _on_ExitLevel_pressed():
|
||||
Game.change_map(load("res://maps/level_select.tscn"))
|
||||
|
|
|
@ -87,3 +87,4 @@ texture_focused = ExtResource( 3 )
|
|||
|
||||
[connection signal="pressed" from="Body/Resume" to="." method="_on_Resume_pressed"]
|
||||
[connection signal="pressed" from="Body/Restart" to="." method="_on_Restart_pressed"]
|
||||
[connection signal="pressed" from="Body/ExitLevel" to="." method="_on_ExitLevel_pressed"]
|
||||
|
|
|
@ -253,7 +253,7 @@ func die():
|
|||
Game.lives -= 1
|
||||
Game.play_sound(Game.a_die,Game.ac_die)
|
||||
if Game.lives < 0:
|
||||
Game.restart_level()
|
||||
Game.call_deferred("restart_level")
|
||||
|
||||
|
||||
func _on_AnimationPlayer_animation_finished(anim_name):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue