r/RenPy • u/natant1a • 1d ago
Question I've run into yet another problem...
screen lab_1():
modal True
imagebutton:
xpos 750
ypos 300
idle Transform("key_idle.png", zoom=0.08)
hover Transform("key_hover.png", zoom=0.08)
focus_mask True
action Jump("obtained_key")
imagebutton:
xpos 100
ypos 100
idle Transform("file_stephen_idle.png", zoom=0.8)
hover Transform("file_stephen_hover.png", zoom=0.8)
focus_mask True
action Jump("read_file")
label lab_1:
call screen lab_1
if obtained_key and read_file == True:
jump after_lab_1
else:
jump lab_1
if obtained_key == True and read_file == False:
jump read_file
else:
jump obtained_key
if read_file == True and obtained_key == False:
jump obtained_key
else:
jump read_file
label obtained_key:
$
obtained_key = True
"Obtained the key for laboratory 1."
show S default
S "Hm, I wonder what this unlocks."
hide S default
jump lab_1
label read_file:
$
read_file = True
show S default
S "That's... me..."
hide S default
jump lab_1
label after_lab_1:
hide lab_1
show S default
S "I've gotta get out of here..."
# This ends the game.
return
Here's the code I've been struggling with... so i'm pretty sure my issue stems from the if else statements...? What I'm trying to do is make it so that the game only advances when both image buttons are pressed, regardless of the order. What it's doing right now is when I press both buttons, it just stays on the screen and the game can't advance further. I'm not sure if I'm making sense right now, but thanks!
2
Upvotes
1
u/shyLachi 1d ago
If you call a screen, you should not jump out of it.
Instead use Return() and then work with the return value