|
@@ -3,6 +3,8 @@ extends Node2D
|
|
|
onready var cam = $MainCamera
|
|
|
onready var start_timer = $StartTimer
|
|
|
|
|
|
+signal round_won
|
|
|
+
|
|
|
# Used to test a level in creation
|
|
|
export (String) var levelToLoop
|
|
|
var levelSceneToLoop
|
|
@@ -34,7 +36,10 @@ func _ready():
|
|
|
player.turn_right_action = playerActionsRight[k]
|
|
|
player.position = Vector2()
|
|
|
add_child(player)
|
|
|
+
|
|
|
start_timer.connect("timeout", player, "_on_round_start")
|
|
|
+ player.connect("crash", self, "_on_player_crash")
|
|
|
+ self.connect("round_won", player, "_on_round_won")
|
|
|
|
|
|
func load_level(name):
|
|
|
var fullName = "res://Levels/" + name + ".tscn"
|
|
@@ -84,5 +89,6 @@ func create_game():
|
|
|
# Delay start
|
|
|
start_timer.start()
|
|
|
|
|
|
-func _on_round_end():
|
|
|
- get_tree().call_group("players", "_on_round_end")
|
|
|
+func _on_player_crash():
|
|
|
+ if get_tree().get_nodes_in_group("living").size() <= 1:
|
|
|
+ emit_signal("round_won")
|