Passcoded Doors

This forum is currently in read-only mode.
From the Asset Store
The package contains 105 sounds This sound library is perfect for voicing mechanical doors in your Sci-Fi game.
  • you'll want to test if the editbox = zeropad(computer.value('code'),4)

    its probably getting confused with strings and integers etc, adding the zeropad should sort things out.

  • Thanks alot dude. Thats all I needed at least for now.

  • OK another problem heh, sorry to trouble everyone with this. The computers generate a passcode and the containers get the correct values, the problem is that it has to be the exact same order as the 4 digit pass code. Is there a way to way to make it so that you just need the correct numbers?

    for example the computer's password is 5698 and the player were to put in the same digits in a different order like 6895. is it possible to make it still work?

  • You could try making it so that the door code is actually the sum of all the separate numbers added together, and inputting the code just adds the numbers up. Then when the sums match, the door opens. Kind of a cheap way to do it, but it would work. Then they could punch the numbers in in any order they wanted.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

  • 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.

  • oh brother I have a headache now, Ill try your idea tomorrow. Thanks for the input everyone.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)