Godot Version
Godot v4.6.2.stable (001aa128b)
Question
Came across this weird behaviour while following a fps tutorial, relating to an ammo pickup updating the label. I managed to make an MRP of it here. similar hierarchy, node implementation, and logic.
It has 3 scripts shape.gd, shape_switch.gd, shape_handler.gd.
2 shapes that inherit from a shape scene and _shape.gd. spacebar to give tribute to each shape.
shape_switch.gd handles displaying and switching between shapes with 1 and 2 keys to switch between a cube and ball shape.
shape_handler.gd stores the tributes given to each shape, has a boolean flag to tell whether the shape is currently being displayed or not, and updates the label for each shape accordingly.
press the spacebar, add exclamation marks to the dictionary of tributes for each shape. simple. however, when pressing the spacebar when the 1st child is displayed, the label doesn’t update, but it updates as expected when the 2nd child is displayed. the label for the 1st child will update when swapping back to it, but not when pressing the spacebar.
the issue appears to happen in shape_switch.gd in the else block of the display_shape() function, it sets the boolean variable of both children to false, when it’s supposed to set one.
I don’t know why it behaves the way it does, and maybe someone here can spot something about my code that i missed.