Before anything, I'ma noob who learned about this engine 'bout 3 weeks back. Sorry!
Anyway, I'm trying to make a naughts-and-crosses-type game, so I'm want to create 9 instances of a piece scene in a rectangular fashion
Contents of MainScreen.gd:
var piece = preload("res://pieces.tscn") #Preload the piece scene
var slots = 
for x in range(3):
slots.append("") #Now we've got slots
for y in range(3):
add_child(piece.instance()) #add that to the tree
get_node("piece").position = Vector2(300*x+92, 292*y+92) #Set the position of the newly added node
slots[x][y] = get_node("piece/AnimatedSprite").animation #Get the name of current animation for game logic purposes ("black" rn for demonstration only, normally would be "default")
The problem is, the code is changing the position of only one of nine children, when it supposed to modify each one separately! So now, the first piece is where the last is supposed to be, and every-single-other-one has defaulted to, erm, the default position! (0, 0)
So, I'm definitely doing something wrong, but cruising thru the documentation and googling to the best of my ability, I can't really find a solution to this here problem. Also, I'd like to further change the properties of these scenes (the pieces) later in code (if it's important).
Again, I apologise for being a noob, but any help is appreciated!