Passcoded Doors

For questions about using Classic.

Post » Tue Sep 30, 2008 2:01 am

true but in that case couldnt they just punch in 4114 or 3223 and it would come to the same answer? man this is more of a challenge than I thought
B
2
S
1
G
4
Posts: 239
Reputation: 1,778

Post » Tue Sep 30, 2008 2:37 am

Well, yeah, I guess so.

How about this: Instead of the code being one number, it's four separate numbers, one each in it's own variable.

Then there's a computerSum variable in the computer that adds them all up.

Then there's another variable called buttonSum that is empty, waiting for the player to enter numbers.

Then there's a counter that counts the number of button presses.

When the player pushes a button, a quick check is made to see if that number matches any of the pieces of the code. If so, it adds the number to buttonSum. If not, then buttonSum and the counter are reset to 0.

When the counter reaches 4, then buttonSum and computerSum are compared. If they're the same, the door opens. If not, then buttonSum and the counter are reset to 0.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Tue Sep 30, 2008 2:42 am

oh brother I have a headache now, Ill try your idea tomorrow. Thanks for the input everyone.
B
2
S
1
G
4
Posts: 239
Reputation: 1,778

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests