I have a point and click mini-game where you only have 3 clicks to find a key to open the door.
Originally, I had the key in the "coatpocket" (which was called "key") but I'd like to randomise the location of the key so it's different each time. The key could hide in the "coatpocket", "pottable", "baghook" or "bowltable".
Here's my code:
Code: Select all
label hallway_search:
if doorunlocked == True:
call screen hallway_unlocked_imagemap
else:
call screen hallway_imagemap
$ result = _return
if result == "pot":
if "pottable" in efound:
t "..."
else:
$ efound.append("pottable")
t "I wonder if there's anything in this pot?"
t "Bah, nothing!"
elif result == "handbag":
if "baghook" in efound:
t "I checked everything in here.\nNothing."
else:
$ efound.append("baghook")
pause 1
t "A wallet...\nSome make-up...\nJunk mail..."
t "Ok.\nThere's nothing in here."
elif result == "bowl":
if "bowltable" in efound:
t "..."
else:
$ efound.append("bowltable")
t "Damn. Nothing in here but paper-clips and other useless stuff."
elif result == "lock":
if "doorlock" in efound:
t "I've already flicked this."
menu:
t "Should I flick it again?"
"Yes":
if doorunlocked == False:
$ doorunlocked = True
show unlocked
elif doorunlocked == True:
$ doorunlocked = False
hide unlocked
"No, leave it alone.":
pause 0.5
else:
$ efound.append("doorlock")
t "Perhaps I should flick this lock.\nMaybe that will open the door?"
$ doorunlocked = True
show unlocked
pause 0.5
if doorkey == True:
t "Yes!"
jump ending
else:
t "Nope. It still won't open."
elif result == "keyhole":
if "key" in efound:
t "Maybe the key I found will fit here?"
$ doorkey = True
t "Bingo!\nSeems like it unlocked."
else:
t "There's no key here."
elif result == "pocket":
if "coatpocket" in efound:
t "I've already searched this."
else:
$ efound.append("coatpocket")
t "Let me just see if there's anything in here..."
t "A key!\nGreat, I wonder if it can open this door?"
elif result == "handle":
if doorkey == True:
if doorunlocked == True:
jump ending
else:
play audio "sounds/door_locked.ogg"
t "Hmm. The door still won't budge.\nIt feels looser at the bottom, though."
else:
if doorunlocked == True:
t "It's still not opening?\nI wonder if it's completely unlocked?"
else:
t "No good.\nThe door won't budge."
if len(efound) <= 3:
jump hallway_search
else:
jump ending_caught
I'm not sure what to add here to change the location of the "key" each time.