Forum rules - please read before posting.

Selectable Button Grid Input

I'm setting up a password lock for a door in my game where the player enters in a numeric password. I have it functional where the player can use the keyboard to type in numbers and press enter to check the code. However, I would ideally rather have the player using UI buttons to enter in the password rather than typing on the keyboard. I'm not sure how to go about this, as the only option I see is to Set the full password rather than inputting a single digit at a time  (using action lists run by AC UI buttons). Any help would be much appreciated! 

Additionally, I want the buttons to be set up in a grid: 3 X 3. When I set buttons up like this and attempt to use the keyboard navigation (I'm using direct control btw, not using mouse / cursor in my game) pressing up and down vs left and right does the same thing. Meaning I can only select the buttons in numerical order. For example if the top three buttons are 1,2,3 and the next row is 4,5,6 and I'm highlighting button 1, I'd have to press right or down three times to get to button 4 (instead of the preferred result of being able to just press down once). This part is more minor but would be great to know how to set it up, if I'm able to. 

Comments

  • Have a "score" system using an integer variable - if the player presses the correct button at the correct time, the score increases by 1; otherwise reset to 0.

    For example, say the "6" key is the third in the sequence - so you should press it when the score is two.  Using Variable: Check Actions, have an ActionList that does something like:

    If score = 2, score = 3
    Else score = 0
  • That's an interesting solution, however I want the player to be able to input any number without it resetting to 0. With this particular lock, any password will open the door but the correct password does something extra in addition to opening the door. 
  • edited June 2016
    @witheredCrow Let us know how it goes, I'm planning on doing something similar. Hopefully the controller can be used in the same manner as keyboard, like it can for inventory.
  • You will need to reset the score to zero in order for the correct password to be recognised.  However, you could use a separate integer to keep track of how many buttons have been pressed, so that any combination will still be valid.
  • I think I figured out a way to achieve what I was after. Instead of using an input box, I use a label that displays a variable. Then when a button is pressed I use Variable, Set, to a formula [var:ID]*10+a where "a" is the number of the button pressed. 

    Thanks for the advice, Chris! The score idea lead me to that solution. 

    The issue with navigating through the grid of buttons is still persistent, doesn't seem like there's a way around it right now. But at least it's functional! 
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.