- Sep 16, 2018
- 14
- 2
Is there a way to loop through an if statement?
I'm using imagebuttons because in my game the user navigates by interacting with objects on screen like doors etc.
I have a situation where I have set the scene, and there's 5 doors to choose from. 4 doors are useless and basically say no answer. The 5th door jumps to another label.
My issue is this, after the first door is clicked, it displays the text …. no answer and then continues on with the next block.
There is a lot more lines of code above this. and I don't want the user moving on until the right door is clicked.
after every wrong door I would like the user to be returned to "screen HallwayIntro" part in the code below.
Code Snippit:
and the screen HallwayIntro is this:
I'm using imagebuttons because in my game the user navigates by interacting with objects on screen like doors etc.
I have a situation where I have set the scene, and there's 5 doors to choose from. 4 doors are useless and basically say no answer. The 5th door jumps to another label.
My issue is this, after the first door is clicked, it displays the text …. no answer and then continues on with the next block.
There is a lot more lines of code above this. and I don't want the user moving on until the right door is clicked.
after every wrong door I would like the user to be returned to "screen HallwayIntro" part in the code below.
Code Snippit:
Code:
while True:
call screen HallwayIntro
if _return == "LivingRoom":
scene RentedHouse1_LivingRoom
if SBI == 0:
"So, this is the living room, Sam said Grey door right in front of me"
elif SBI == 1:
"Oh my god, more doors!!, this is what happens when you act like a cock"
jump Renting1_LivingRoom
elif _return == "S_room":
"Knock Knock"
".........."
"Hmmm, no answer"
elif _return == "mc_room":
"Boom Boom"
"Hmm... that sounds empty."
elif _return == "j_room":
"Knock Knock"
"........."
"Hmmm, no answer"
and the screen HallwayIntro is this:
Code:
screen HallwayIntro:
imagebutton auto "rentedhome1/hallway/door4_morning_%s.png" xpos 1660 ypos 0 focus_mask True action Return("LivingRoom")
if SBI == 1:
imagebutton auto "rentedhome1/hallway/door1_morning_%s.png" xpos 178 ypos 166 focus_mask True action Return("S_room")
imagebutton auto "rentedhome1/hallway/door2_morning_%s.png" xpos 641 ypos 225 focus_mask True action Return("mc_room")
imagebutton auto "rentedhome1/hallway/door3_morning_%s.png" xpos 1280 ypos 200 focus_mask True action Return("j_room")
[\CODE]
Any suggestions are welcome.
Thanks