I'm trying to use a grid to generate custom panel nodes. My Grid has the following function:
var panelInit = null
var panel = 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._init(x, y)
panel.position = map_to_world(Vector2(x, y)) + cell_size / 2
AllyPanel and EnemyPanel extends CusPanel, which in turn extends Area2D
When spawn_panels is ran, I get the following error:
Invalid set index 'position' (on base: 'Nil') with value of type 'Vector2'.
I'm quite new to the engine, so if anyone can point me to what I did wrong I'd appreciate it. Thanks!