Topic was automatically imported from the old Question2Answer platform.
Asked By
huntariel
Hi All,
I’m a total beginner for both coding and game dev. I’m trying to create a simple child book with with various selection options on the way as a first project.
I create pages as different scenes and change them according to selection.
In a particular spot, I have 2 answers (buttons) and I want to hide or show them in certain condition. (condition is visit another scene previously or not).
should_show_button_1() and should_show_button_2() just need to return true or false depending on if the button should show (i don’t know how you are determining it). The key here is the button’s .visible property.
Thank you for your answer.
I believe this is the solution I’m looking for.
Thing is, I still don’t know how to place the conditions.
The conditions are;
Button1 is visible if a certain page (scene) -lets call it Page00X- is already visited (opened) before.
Button2 is visible if not
Could you please assist how can I add these conditions to the code?
huntariel | 2019-10-28 22:11
If you’re not saving that state somewhere, you’ll have to start. One option is to add an autoloaded script. This is a script that is loaded… wait for it… automatically - and is available from every other script. You could call it GameState.gd or something. In that script you can have something like: