extends Node2D

const Enemy = preload("res://Scenes/Objects/Enemy.tscn")
onready var spawnPoints = $SpawnPoints


func get_random_spawnpoint():
	var points = spawnPoints.get_children()
	points.shuffle()
	return points[0].global_position

	
func spawn_enemy():
	var spawn_location = get_random_spawnpoint()
	var enemy = Enemy.instance()
	enemy.global_position = spawn_location
	get_tree().current_scene.add_child(enemy)


func _on_Timer_timeout():
	spawn_enemy()
