Forum Discussion
Door Keypad Interaction
I am creating a virtual escape room activity and after the users solve the 4 clues, they will have 4 digits and will be presented with a keypad where I would like them to touch the correct numbers in the correct order to open the door. I have thought about hotspots and multiple choice questions but I can't quite figure out how to make this happen. I have attached the keypad image I created. How would you accomplish this?
10 Replies
- NedWhiteleyCommunity Member
Hi Christina,
In the attached example, I have created five variables, Keypress, Keypress1, Keypress2, Keypress3 and Keypress4, which are set to 0, -1, -1, -1 and -1 respectively. I have also placed 100% transparent rectangles over each of the buttons on the keypad.
When the user clicks on a number on the keypad, Keypress is set to the value of that button and then Keypress1 is set to the value of Keypress provided Keypress1 = -1. If Kepress1 > -1 (i.e. it already has a number allocated to it), Keypress2 is set to the value of Keypress provided Keypress1 > -1 AND Keypress2 = -1 and so on.
This ensures that each click allocates a number in sequence until four numbers have been selected. At this point, if the correct sequence of numbers has been keyed in (in my example that is 2 4 6 8) the green light comes on and the red light goes out, signifying that the door has been unlocked.
The Reset button resets all variables and re-locks the safe. The Correct Code button (for those who can't crack it) shows the correct code and unlocks the safe.
I have also set up the Keypress 1-4 variables to be displayed above the keys on the keypad when their value changes, so that the user can see the code they have entered.
Hope this helps.
- ChristinaWor667Community Member
Thank you SO MUCH. I will take a look. It look like exactly what I am trying to accomplish.
- ChristinaWor667Community Member
If you want, I can share my story file once I have the whole thing done and you can use it should you find a need.
- NedWhiteleyCommunity Member
Hi Christina,
I'm glad it worked out. Yes, I would love to see the end result when you have it all sorted.
Thanks
- ChristinaWor667Community Member
Can you change the correct code to 2164 and then send me the file again? I tried to figure it out and I think I'm getting the second part of the operation wrong.
- NedWhiteleyCommunity Member
Hi Christina,
All you need to do is to go to the Variable Triggers associated with Keypress4 and change the value of Keypress2 from 4 to 1 and Keypress4 from 8 to 4:
Oval 1 is a 100% transparent oval that sits on top of the green light on the keypad. This has an initial state of Normal, which is changed to Open when the combination is correct. The Open state places a dull red oval (i.e. light off) on top of the red light and also removes the red glow around the outside. In addition it also places a bright green oval and green glow over the top of the green light.
- PhilMayorSuper Hero
It may be simpler to set up a simple calculator.
https://360.articulate.com/review/content/8095e0b7-332d-4ca4-8a43-89f82931a54a/review
The passcode is 1234, is simply set as a variable value (correct) the keypresses could be displayed as text by displaying the variable calculate. It could benefit with some sound effects.
- ChristinaWor667Community Member
Thank you for the help!
- ChristinaWor667Community Member
Thank you. I had just figured it out.
- GrahamBaguley-1Community Member
Ned,
Your keypad is just what I had been looking for. I hoever need to have 5 numbers entered and then an enter. Cant work out how to add the additional keypress to enable me to do this. Any thoughts?