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.
I'm creating a dating simulator and I'm trying to create the imagebutton and the screens but my code feels clunky wrong. I have it working so far but with a lot of hotfixes that shouldn't be there probably.
Is this code right or is there a better way to accomplish all of this?
label homeroom:
hide b #Hot fix number one. Later in the game I show a character. I can't figure out how to hide this character properly. The only solution is hiding it in the main label. I definitely dont want to start each label by hiding every possible character.
if day == 0: # First Day
p "I should introduce myself to my classmates. I can't be a loner again..."
call screen homeroom_options
call screen homeroom_options
screen homeroom_options:
imagebutton: # simple imagebutton for a character. This is working as intended I'm pretty sure.
idle "buttons/bethanyg.png"
hover "buttons/bethanyh.png"
focus_mask True
action [Jump ("bethany")]
label bethany:
show b smile # This is where I show bethany but then am unable to hide her.
b "hey"
call screen bethany_options
return
screen bethany_options:
imagebutton:
idle "backgrounds/transparent.png"
action [Hide ("bethany_options"), Jump ("homeroom") ] #if the player clicks on not one of the options I jump back to homeroom where you can interact with a separate character. Is it possible to hide the "b smile" in this action?
imagebutton:
idle "boxes/talkg.png"
hover "boxes/talkh.png"
action [Hide ("bethany_options"), Jump ("talkbethany")]
xpos 500
ypos 850
imagebutton:
idle "boxes/flirtg.png"
hover "boxes/flirth.png"
action [Hide ("bethany_options"), Jump ("flirtbethany")]
xpos 800
ypos 850
imagebutton:
idle "boxes/giveg.png"
hover "boxes/giveh.png"
action [Hide ("bethany_options"), Jump ("flirtbethany")]
xpos 1100
ypos 850
P.S. What's the difference between calling a screen and showing one?
label homeroom:
hide b #Hot fix number one. Later in the game I show a character. I can't figure out how to hide this character properly. The only solution is hiding it in the main label. I definitely dont want to start each label by hiding every possible character.
label my_label:
scene my_background_image #That should clear out the characters and the images but not screens, and sound
I usually put screens in a separate file just to keep things organized.
You asked what is the difference between calling and showing a screen.
I would need to test this to confirm, but I believe when you call a screen you limit the users ability to advance story until they interact with the screen. And when you show it they can still keep reading the story whether or not they interact with the screen.
I didn't see anything wrong with the rest is OK if it is doing what you want. But I had some problems with "focus masks" in the past not building on android. I am not sure if that has been corrected with v6.99.12. I usually just avoid them.
Last edited by justcolorado on Wed Jan 25, 2017 10:02 pm, edited 1 time in total.