The main menu has a button that should open the Appstore/Playstore, but before that there is a parental gate with randomly generated math questions. The code for the question was done within a label and a screen as I couldn't find a way to do it purely with screens.
Code: Select all
screen navigation():
imagebutton:
action Jump ("gate")
init python:
pg1 = renpy.random.randint(5, 6) #variables for the parental gate
pg2 = renpy.random.randint(1, 3)
pg3 = pg1 - pg2
label gate:
$ result = _return
call screen gate
if result == pg3: #pg3 is a variable from the math question that relates to the parental gate
call screen thanks
if result == "goback": #for some reason this requires two clicks and then it starts the game.
return
return
screen gate:
text "What is [pg1] - [pg2]"
hbox:
textbutton _("1") action Return(1) # sometimes I need to click the answers two times for this to work.
# etc.
textbutton _("Go Back") action Return("goback") #for some reason this requires two clicks and then it starts the game.
screen thanks:
on "show" action OpenURL("blahblahblah")
text "Thanks!"
textbutton _("Go Back") action Return() # It seems that this does not always work.
Any suggestions? I assume that this problem has its root in the label.
Thank you for taking the time to read this far.