I'm trying to have the player enter the passcode on a phone on the screen. They have to click certain hotspots (which would be numbers on the phone) in a certain order in order for an action to occur. For example, the passcode is 1234. I have hotspots for each of the numbers on the imagemap. If they click on those 4 hotspots in the right order, it would call to another screen. I'm not quite sure where to start.
I'm fairly new to python and ren'py but hopefully what I want to happen makes sense. Please let me know if you need more info from me for an answer!!
imagemap hotspots in the correct order for an action to occur
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.
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.
- hell_oh_world
- Miko-Class Veteran
- Posts: 777
- Joined: Fri Jul 12, 2019 5:21 am
- Contact:
Re: imagemap hotspots in the correct order for an action to occur
This should give you an idea, not through the use imagemap though as I'm not really familiar with it. But the concept is the same.
Code: Select all
default correct_pin = [1, 0, 0, 2] # we list down the correct pin so technically the correct pin is 1002
screen pin_unlocker():
default pin = []
vbox:
align (0.5, 0.5)
text " ".join([str(p) for p in pin]) # just some display of the current pin combination
grid 3 4: # should look like a keypad for a mobile phone
for number in range(9):
textbutton str(number + 1):
action Function(pin.append, number + 1)
sensitive len(pin) != len(correct_pin)
xysize (50, 50)
background "#15151533"
hover_background "#15151577"
null
textbutton "0":
action Function(pin.append, 0) # you can make use of this action as the hotspot action, where you append whatever the number of the hotspot
sensitive len(pin) != len(correct_pin)
xysize (50, 50)
background "#15151533"
hover_background "#15151577"
null
if len(pin) == len(correct_pin):
timer 2.0:
action Return(pin) # we return the pin entered once finished
label start:
call screen pin_unlocker
if _return == correct_pin: # we check if the combination is exactly the same as the correct_pin
"Succeeded!"
# call screen screen_name in your case, since that's what you want to happen once the pin is correct...
else:
"Failed!"
Who is online
Users browsing this forum: bilmem, Google [Bot]