notSpore/evolve-die-repeat/molecular/preyManager.gd

28 lines
731 B
GDScript

extends Node
var preyScene = preload("res://molecular/nucleotide_prey.tscn")
#var predatorScene = preload("res://Predator.tscn")
var score
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
for i in range(0, 100, 10):
spawn_creature(preyScene, Vector2(i, i))
spawn_random()
spawn_random()
spawn_random()
spawn_random()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func spawn_random() -> void:
spawn_creature(preyScene, Vector2(randfn(100, 100), randfn(100, 100)))
func spawn_creature(scene, position: Vector2) -> void:
var instance = scene.instantiate()
instance.position = position
add_child(instance)