the FighterQueue node's code (the tree screenshot and the snippet dont show the whole thing but it doesnt matter for this situation)
extends PanelContainer
@onready var queue := $HBoxContainer/QueueScroller/ActualQueue
# The problematic part (error attached)
func _on_tick_timer_timeout() -> void:
if queue.get_children():
print(queue.get_children())
for card in queue.get_children():
card.set_hp(round(lerp(card.hp_bar.value, card.character.base_hp, .1)),round(lerp(card.bonus_bar.value, card.character.bonus_hp, .1)),card.character.max_hp)
The CharacterCard node's code
extends PanelContainer
class_name CharacterCard
@export var character : CharacterBase :
set(value):
character = value
var img = Image.load_from_file(character.icon_dir)
var tex = ImageTexture.create_from_image(img)
icon_box.texture = tex
name_bar.text = str(character.name)
set_hp(character.base_hp, character.bonus_hp, character.max_hp)
@onready var icon_box : TextureRect = $CardContainer/CharacterVisualsContainer/CharacterIcon
@onready var hp_bar : ProgressBar = $CardContainer/CharacterVisualsContainer/CharacterName
@onready var bonus_bar : ProgressBar = $CardContainer/DataContainer/BaseHP/BonusHP
@onready var hp_counter : Label = $CardContainer/DataContainer/BaseHP/HPCounter
@onready var name_bar : Label = $CardContainer/CharacterVisualsContainer/CharacterName
func _init(ch) -> void:
character = ch
func set_hp(base, bonus, max):
hp_bar.value = base
bonus_bar.value = base + bonus
if base + bonus > max:
hp_bar.max_value = base + bonus
bonus_bar.max_value = base + bonus
else:
hp_bar.max_value = max
bonus_bar.max_value = max
hp_counter.text = str(hp_bar.value) + "/" + str(max) + "+" + str(bonus_bar.value) + " HP"