27 lines
554 B
GDScript3
27 lines
554 B
GDScript3
extends Node2D
|
|
|
|
signal collide
|
|
|
|
# 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():
|
|
randomize()
|
|
levelpicker()
|
|
|
|
|
|
func levelpicker():
|
|
var generic = load("res://Generic.tscn").instance()
|
|
add_child(generic)
|
|
var level = load("res://obstacles/pairs/" + str((randi() % 15) + 1) + ".tscn").instance()
|
|
generic.add_child(level)
|
|
level.connect("collide", self, "_collide")
|
|
|
|
func _collide():
|
|
emit_signal("collide")
|
|
|
|
func _on_Timer_timeout():
|
|
levelpicker()
|