Door Keypad Interaction

Apr 13, 2020

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
Ned Whiteley

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.

Phil Mayor

It may be simpler to set up a simple calculator.

 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. 

Ned Whiteley

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.