Hey! I'm somewhat new to godot, so I tried starting out with something super simple - Drew up four arrows and wanted to spawn a variable series of them to hit in the correct order. If the right button is pressed, it turns blue, if its the wrong one, it turns black.
So far so good, managed for a simple scene to work.
Made an arrow in the upper right corner that shows me what input I pressed, a control box with the four arrows next to it, and the third one spawns a random one each time i hit the button and works. Those three are my control group and they are very nicely behaving.
But now I'm kind of stuck and could use some help
I wanted to make the number of spawning elements variable, so I runtime generate as many of them as an exported variable tells them to (in this example 10).
Goal is to be able to modularly send in an array(or whatever better alternatives there might be), numbers correlating to the direction that should be displayed (0 = random, 1 = up, 2 = down, 3 = right, 4 = left) and size to the number of boxes spawn.
Making me able to create patterns for different situations, enemies and whatnots.
I tried to go through each one of them using their index - That...KINDA works but also not really? Now, only a few of the runtimegenerated group react correctly.
At runtime start, they are all empty (Index currently has +10 added to it), but spawn as soon as i hit the random generator.
Vice versa, if I do not add a value of +10, it spawns once on runtime but never after.
Lastly, I want the player to have to hit the arrows in order, not at the same time.

White top right arrow shows my input, guy next to it also does so with the stylized arrows and changing color depending on direction, next to it randomly generates and reacts on buttonpress how it's kind of supposed to - only once, and renews on hitting randomize. Top left is just multiple of those. Underneath as well, just tested a grid container.
The important ones are the two rows of five
Issues in short: (Mostly lack of understanding on my part)
a) Weird indexing (depending on how much is added to it, either spawns on first load but not after, or not on first load but after)
b) Incorrect reaction of symbols
c) Make it so the input is asked for one displayed arrow at the time, hitting the right buttons in the right order
I'm super stumped and any help would be appreciated!
Gridspawn2 code:
extends Control
export var numOfArrows : int
export(String, FILE) var nodePrompt_path
onready var nGridCont := get_node("CenterContainer/GridContainer")
var scene_instance_Prompt = preload("res://ArrowTest02/ArrowPrompted2.tscn")
export var arrayEnemy01 = [1, 2, 3, 4] #needs to be 1 - 4 or error
var setup_array = [1, 2, 3, 0, 1, 1, 1, 1, 0, 0, 2, 2] #0 - Random, 1 Up, 2 Down, 3 right, 4 left
signal sig_arrowValue(value)
var number = 3
func _ready():
_func_arrowSetup()
var cursor_index : int = 0
func get_current_item_at_index(index : int) -> Control:
return nGridCont.get_child(index) as Control
func _func_arrowSetup():
var setup_index = 0
for child in nGridCont.get_children():
child.queue_free()
for i in range(0, numOfArrows, +1):
var instance = scene_instance_Prompt.instance()
nGridCont.add_child(instance)
var current_child := get_current_item_at_index(setup_index +numOfArrows)
if current_child != null:
if current_child.has_method("testGreeting"):
current_child.testGreeting(setup_array[setup_index])
setup_index += 1
func _on_Button_pressed():
_func_arrowSetup()



