I have a Grid, which extends TileMap, and I'm trying to spawn panels in. Panels extend Area2D.
The hierarchy:
Main scene -> player grid scene -> grid scene -> [player scene, x number of panel scenes (added via spawn_panels function)].
Please note that these are all the above are added in the 2D editor, and only the panels are added via script.
To spawn the panels, I have this function ran in _ready in Grid:
func spawn_panels(charType):
var panelInit = null
var panel = null
var childPanel = null
if charType == PLAYER:
panelInit = AllyPanel
elif charType == ENEMY:
panelInit = EnemyPanel
for x in grid_s_x:
for y in grid_s_y:
panel = panelInit.new(x, y)
self.add_child(panel)
panel.set_owner(self)
panel.set_name("panel" + str(x) + str(y))
panel.position = map_to_world(Vector2(x, y)) + cell_size / 2
However, the panels are not visible when the game is ran. I have printed the tree and can see that they are added properly, and also verified that they are not added out of bounds as I've hard coded their position to 0, 0 and the player position (player is visible) but it is still not visible.
Any help is appreciated, thanks!