Anxt
Senior Member
Posts: 588
Threads: 12
Joined: Mar 2011
Reputation:
10
|
RE: How to make a make a door that need two keys to unlock it?
Sorry about that, Raymond. I'll see if I can simplify it.
Basically what I did in my code is set up the keys to add value to a variable rather than unlock the door directly. This is because otherwise just using one key would unlock it.
The variable "KeysUsed", upon reaching 2, will call for the door to be unlocked. Each key used increases the value of "KeysUsed" by 1.
The if statement makes sure that the door is unlocked directly after using the second key, since it will check both times a key is used. The first time, it gets a value of 1, so it does nothing. The second time, it gets a value of 2, and calls for the door to be unlocked.
Hopefully that explanation didn't make things worse.
|
|
03-08-2011, 05:41 PM |
|