So essentially I am creating status effects, when a button comes up I then want to be able to hover over the button to show what the status effect does. I got it to work for 1 button but when I add more buttons to the container the newest button seems to be the only one to show in the label. Though when I trouble shoot the .is_hovered() buttons they print to the console so it is strange.
var psnBtn = Button.new()
var bleedBtn = Button.new()
var stunBtn = Button.new()
func entertree():
psnBtn.icon = load("res://Sprites/PoisonIcon.png")
psnBtn.flat = true
bleedBtn.icon = load("res://Sprites/BloodIcon.png")
bleedBtn.flat = true
stunBtn.icon = load("res://Sprites/StunIcon.png")
stunBtn.flat = true
$BattleSceneCanvas/EnemyStuff/StatusGrid.addchild(psnBtn)
$BattleSceneCanvas/EnemyStuff/StatusGrid.addchild(bleedBtn)
$BattleSceneCanvas/EnemyStuff/StatusGrid.add_child(stunBtn) #testing purposes
func func _process(delta):
statusButtonHover()
func statusButtonHover():
if(psnBtn.ishovered()):
$BattleSceneCanvas/statusLabel.text = "Poisoned, Take 1 Dmg Until Cured!"
$BattleSceneCanvas/statusLabel.visible = true
else:
$BattleSceneCanvas/statusLabel.visible = false
if(bleedBtn.ishovered()):
$BattleSceneCanvas/statusLabel.text = "Bleeding, Take %d Dmg at the Start of the Next Turn" % (round(player.getAtk() * .25))
$BattleSceneCanvas/statusLabel.visible = true
else:
$BattleSceneCanvas/statusLabel.visible = false
if(stunBtn.is_hovered()):
$BattleSceneCanvas/statusLabel.text = "Can't Attack for 1 Turn"
$BattleSceneCanvas/statusLabel.visible = true
else:
$BattleSceneCanvas/statusLabel.visible = false
I feel like this is pretty straight forward just not sure what I am missing. Thanks in advance!