Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
default show_stats = False
default show_contacts = False
default show_test = True
screen my_stats():
imagebutton auto "mobile_%s.png" at topright action ToggleVariable("show_stats")
if show_stats:
frame:
background "Misc/phone.png"
xpos .4
hbox:
yoffset 50
text "POOO"
textbutton "Contacts" action ToggleVariable("show_contacts")
if show_contacts:
frame:
hbox:
text "TEST"
if show_test:
image("button_idle.png")
text "mooo"
What it is supposed to do is place an imagebutton in the topright corner of my screen which upon clicking shows a stat screen that looks like a mobile phone. The plan is to have three pages with stats, contacts, and messages.
The screen comes up as planed, but the problem is that I also want the game to hide the textbox and any character sprites currently displayed when the mobile screen comes up, which it doesn't do currently. Clicking anywhere that isn't a text/imagebutton also advances the game which I also do not want.
Does anyone have an idea how I could achieve this?
There are possibly other ways to do this, but you can use two screens, one to show the phone button, and different screens to show the stats and other menus, that can be invoked by that button with the ShowMenu screen action.
screen phone_button():
textbutton "My Stats" action ShowMenu('phone_menu')
screen phone_menu():
#Show the player's stats
text "Player's stats here"
textbutton "Return" yalign .5 action Return()
label start:
show screen phone_button #show the button screen
"Test"
return
ShowMenu hides everything before showing the screen you're passing it, and stops the game from advancing until you exit from it. Always remember to add a button to that screen so the player can exit.
EDIT: It doesn't seem to hide character sprites. Hmm... I'll have to tinker with this a bit more.
Should clear the 'master' layer when doing ShowMenu... Alternatively (as it might clear backgrounds too) move the sprites to a named layer and add that to config clear