This commit is contained in:
Hurlu 2020-04-04 15:58:54 +02:00
commit 123f88e38d

21
Scripts/GameManager.gd Normal file
View File

@ -0,0 +1,21 @@
extends Node2D
onready var spawnPoints = get_tree().get_nodes_in_group("spawn_point")
var buckets = Array()
func _ready():
buckets.append(load("res://Scene/Player.tscn"))
func spawnBucket():
var newBucket = buckets[randi() % buckets.size()].instance()
self.get_parent().add_child(newBucket)
newBucket.add_to_group("bucket")
newBucket.set_position(spawnPoints[randi() % spawnPoints.size()].get_position())
func _process(delta):
if get_tree().get_nodes_in_group("bucket").empty():
spawnBucket()
func endGame():
pass