![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Cyanic Cipher |
I’m wanting to create code in GDscript that populates a horizontal container with the sprites in scenes. These scenes are stored in an array. I got the panels working, but I’m not sure how to go about moving/adding the sprite to the created panel, or if this is even possible. This is what I have:
extends HBoxContainer
export (Array, PackedScene) var Arsenal
onready var panel = load("res://src/GUI/ArsenalPanel.tscn")
func _ready():
for x in Arsenal:
var panel_inst = panel.instance()
var scene_inst = x.instance()
var sprite = scene_inst.get_node("Base") # the sprite to display
sprite.centered = false
add_child(panel_inst)