Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | NoTheOtherMatt |
I have a checkButton, that when toggled, turns on or off hard mode in my game. The checkButton is in my Options Menu scene, and it changes the hard_mode variable in my GlobalVar AutoLoad script from True to False or False to True. However, when I leave the Options Menu scene and return, even if the checkButton was toggled to on, it now shows off. It doesn’t actually change my variable, but I want the button the stay on if I turn it on.
Can I just put in an if statement that looks at the hard_mode GlobalVar and if true show toggled if false don’t toggle?
my GlobalVar path is $“/root/GlobalVar”.hard_mode
How are you toggling it? You should have the button_down()
signal connected and GlobalVar.hard_mode = !GlobalVar.hard_mode
Magso | 2020-09-05 14:31
It toggles with a left click, and sends a signal to the options menu
func _on_CheckButton_toggled(button_pressed):
$“/root/GlobalVar”.hard_mode = not $“/root/GlobalVar”.hard_mode
print($“/root/GlobalVar”.hard_mode)
NoTheOtherMatt | 2020-09-05 14:42