merged
This commit is contained in:
commit
123f88e38d
21
Scripts/GameManager.gd
Normal file
21
Scripts/GameManager.gd
Normal 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
|
Loading…
x
Reference in New Issue
Block a user