key input destroy in sequence

Get help using Construct 2

Post » Wed Nov 27, 2013 12:18 pm

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.
B
4
S
1
Posts: 15
Reputation: 455

Post » Wed Nov 27, 2013 12:30 pm

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 told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Nov 27, 2013 2:54 pm

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.
B
4
S
1
Posts: 15
Reputation: 455

Post » Wed Nov 27, 2013 10:29 pm

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?
B
46
S
16
G
79
Posts: 2,170
Reputation: 46,857

Post » Thu Nov 28, 2013 5:22 am

[QUOTE=plinkie] 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?[/QUOTE]

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...
B
4
S
1
Posts: 15
Reputation: 455

Post » Thu Nov 28, 2013 11:08 am

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.plinkie2013-11-28 11:09:26
B
46
S
16
G
79
Posts: 2,170
Reputation: 46,857


Return to How do I....?

Who is online

Users browsing this forum: jbr190, valefor and 33 guests