extends Node

var crickettscn = load("res://cricketScene/cricket.tscn")

var preset_grpA = [
	[-7, -2, 3996, 30, 0.7],
	[-7, -2, 3896, 30, 0.5],
	[-7, -2, 3596, 30, 0.5],
	[-7, -2, 3606, 60, 0.9]
	]

var preset_grpB = [
	[1, 7, 11086, 30, 0.5],
	[1, 7, 10086, 340, 0.5],
	[1, 7, 11486, 390, 0.5],
	[1, 7, 12086, 400, 0.5]
	]

var preset_grpC = [
	[1, -9, 19, 10, 0.5],
	[5, -9, 11, -10, 0.5],
	[3, -10, 7, 20, 0.5],
	[6, -9, 9, 10, 0.5]
	]

var preset_grpD = [
	[-7, -2343, -1550, 30, 0.4],
	[-8, -2233, -1481, 10, 0.5],
	[-7, -2483, -1531, 30, 0.4],
	[-7, -2281, -1581, 10, 0.7]
	]

var preset_grps = [
	preset_grpA,
	preset_grpB,
	preset_grpC,
	preset_grpD
	]

var preset_colors = [
	Color.greenyellow,
	Color.deeppink,
	Color.lavender,
	Color.aqua
	]

func _ready():
	randomize()
	for i in range(8):
		var cricket = crickettscn.instance()
		cricket.set_param(preset_grps[0][randi()%4])
		cricket.set_color(preset_colors[0])
		cricket.audible_range_max = 20
		add_child(cricket)
		cricket.relocate(Vector2(20, 20), [4, 8])

	for i in range(8):
		var cricket = crickettscn.instance()
		cricket.set_param(preset_grps[1][randi()%4])
		cricket.set_color(preset_colors[1])
		cricket.audible_range_max = 20
		add_child(cricket)
		cricket.relocate(Vector2(-20, 20), [4, 8])

	for i in range(8):
		var cricket = crickettscn.instance()
		cricket.set_param(preset_grps[2][randi()%4])
		cricket.set_color(preset_colors[2])
		cricket.audible_range_max = 20
		add_child(cricket)
		cricket.relocate(Vector2(-20, -20), [4, 8])

	for i in range(8):
		var cricket = crickettscn.instance()
		cricket.set_param(preset_grps[3][randi()%4])
		cricket.set_color(preset_colors[3])
		cricket.audible_range_max = 20
		add_child(cricket)
		cricket.relocate(Vector2(20, -20), [4, 8])

func _on_Timer_timeout():
	Global.nextScene()
