key input destroy in sequence

0 favourites
  • 6 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • Hello,

    I'm making a game where the user needs to enter in 6 lettered keys that appear on the screen.

    At the moment I have 6 different text objects which show a random letter each with none repeating.

    The problem is that once I enter a key that is correct the score will go up but if you enter the 6th letter 6 times then you will be given the max score rather than entering the keys separately.

    Thanks in advance.

  • There are many ways to achieve this, depending on how you heve your events set up.

    One way would be to give the text objects a boolean variable that is set to true when the letter is typed. you could add conditions to make sure that the second, third and later textboxes variables can only be set to true if the ones before are true.

  • I have given each text object a Boolean with an initial value of false.

    The letters are chosen at random from a global text variable which contains "abcdefghijklmnopqrstuvyxyz".

    These are put into an array which shuffles the 26 letters of the alphabet and each text object prints out the last 6 letters of the shuffle.

    With a correct key input I have a global variable called letterProgress = 0, that adds 1 for each correct key input. When letterProgress = 1 it sets the 1st text object to true.

    The next correct key input adds another 1 to letterProgress and while the 1st boolean from the 1st text object is true then the next event is activated.

    The same problem persists even with the booleans.

    Any further help will be greatly appreciated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is the problem here that you can enter the 6th letter 6 times as part of the sequence or that you can enter the first 5 letters correctly and then press the 6th letter 6 times i.e. the sequence doesn't reset?

  • Is the problem here that you can enter the 6th letter 6 times as part of the sequence or that you can enter the first 5 letters correctly and then press the 6th letter 6 times i.e. the sequence doesn't reset?

    The first part you said is correct, enter the 6th letter 6 times and the game will complete.

    Enter the 4th key 4 times and you would get a score of 4 but enter 5 you would get +4 and -1 or 6 and get -2.

    You can go onto enter the last 2 keys of this correctly.

    Please help...

  • Try setting the value of letter progress instead of adding to it so that 1st letter pressed = set letterprogress 1, 2nd letter pressed = set letterprogress 2 and only have the sequence run when letterprogress = 6. Then, to ensure you can't just press the final letter for letterprogress = 6, set up some conditions so that, for example, 2nd letter can only be pressed if letterprogress already = 1, 3rd letter can only be pressed if letterprogress already = 2. Remember to set letterprogress back to 0 when the sequence is initiated.

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