chain levels with spaghetti
This commit is contained in:
parent
7a18c4f8c6
commit
6a59b54c11
10 changed files with 465 additions and 15 deletions
22
levels/level.gd
Normal file
22
levels/level.gd
Normal file
|
@ -0,0 +1,22 @@
|
|||
extends Node3D
|
||||
|
||||
var rings_count = 72727
|
||||
var finished_rings_count = 0
|
||||
var rings: Array[Node] = []
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var rings_node = get_node("Rings")
|
||||
assert(is_instance_valid(rings_node), self.name + " has no rings!")
|
||||
rings = rings_node.get_children()
|
||||
rings_count = len(rings)
|
||||
|
||||
for ring in rings:
|
||||
ring.connect("collect_signal", do_we_end_yet)
|
||||
|
||||
func do_we_end_yet():
|
||||
finished_rings_count += 1
|
||||
if finished_rings_count >= rings_count:
|
||||
var game = get_parent().get_parent()
|
||||
if is_instance_valid(game) and game.has_method("stop_level"):
|
||||
game.stop_level()
|
Loading…
Add table
Add a link
Reference in a new issue