|
@@ -15,7 +15,7 @@ var levelIndex = -1
|
|
|
|
|
|
var is_round_won
|
|
|
|
|
|
-var _players_connected = false
|
|
|
+var _liners_connected = false
|
|
|
|
|
|
onready var cam = $MainCamera
|
|
|
onready var start_timer = $StartTimer
|
|
@@ -47,20 +47,20 @@ func _unhandled_input(event):
|
|
|
get_tree().set_input_as_handled()
|
|
|
|
|
|
|
|
|
-func connect_players():
|
|
|
- if _players_connected:
|
|
|
- push_error("Players are already connected!")
|
|
|
+func connect_liners():
|
|
|
+ if _liners_connected:
|
|
|
+ push_error("Liners are already connected!")
|
|
|
return
|
|
|
|
|
|
- for player in get_tree().get_nodes_in_group("players"):
|
|
|
+ for liner in get_tree().get_nodes_in_group("liners"):
|
|
|
|
|
|
- start_timer.connect("timeout", player, "_on_round_start")
|
|
|
- self.connect("round_won", player, "_on_round_won")
|
|
|
- self.connect("arena_removed", player, "_on_arena_removed")
|
|
|
+ start_timer.connect("timeout", liner, "_on_round_start")
|
|
|
+ self.connect("round_won", liner, "_on_round_won")
|
|
|
+ self.connect("arena_removed", liner, "_on_arena_removed")
|
|
|
|
|
|
- player.connect("crash", self, "_on_player_crash")
|
|
|
+ liner.connect("crash", self, "_on_liner_crash")
|
|
|
|
|
|
- _players_connected = true
|
|
|
+ _liners_connected = true
|
|
|
|
|
|
|
|
|
func load_level(name):
|
|
@@ -95,25 +95,25 @@ func create_game():
|
|
|
# Put the level far away, the tween will bring it back
|
|
|
levelCurrentNode.position.y = 2000
|
|
|
|
|
|
- # Manually spawn players for the first game
|
|
|
+ # Manually spawn liners for the first game
|
|
|
if levelOldNode == null:
|
|
|
# TODO : remove duplicated code with func _on_swap_completed
|
|
|
add_child(levelCurrentNode)
|
|
|
- spawn_players()
|
|
|
+ spawn_liners()
|
|
|
levelSwap.swap_in(levelCurrentNode)
|
|
|
|
|
|
|
|
|
-func spawn_players():
|
|
|
+func spawn_liners():
|
|
|
var spawners = get_tree().get_nodes_in_group("spawn")
|
|
|
spawners.shuffle()
|
|
|
|
|
|
- var p = get_tree().get_nodes_in_group("players")
|
|
|
+ var p = get_tree().get_nodes_in_group("liners")
|
|
|
|
|
|
for k in p.size():
|
|
|
p[k].spawn(levelCurrentNode, spawners[k].position, spawners[k].rotation_degrees)
|
|
|
|
|
|
|
|
|
-func _on_player_crash():
|
|
|
+func _on_liner_crash():
|
|
|
if get_tree().get_nodes_in_group("running").size() <= 1 and !is_round_won:
|
|
|
emit_signal("round_won")
|
|
|
is_round_won = true
|
|
@@ -130,7 +130,7 @@ func _on_swap_completed(object, _k):
|
|
|
levelOldNode = null
|
|
|
|
|
|
add_child(levelCurrentNode)
|
|
|
- spawn_players()
|
|
|
+ spawn_liners()
|
|
|
levelSwap.swap_in(levelCurrentNode)
|
|
|
|
|
|
elif object == levelCurrentNode:
|
|
@@ -138,5 +138,5 @@ func _on_swap_completed(object, _k):
|
|
|
|
|
|
|
|
|
func _on_hub_finished():
|
|
|
- connect_players()
|
|
|
+ connect_liners()
|
|
|
create_game()
|