How do I compare sequences of clicked buttons

Get help using Construct 2

Post » Sat Oct 01, 2016 2:06 pm

I need some help to produce this project.

I will create a game where the user have to choose 2 buttons per time from the 5 different buttons. The player can repeat this action from 1 to 10. For example: in the first time the player can choose the button 1 and button 3, then they can choose the buttons 2 and 4 and stop, confirming it through a "confirm" button. This was a sequence.

Before that, a new sequence can be created. Just to exemplify: the player chooses the buttons 3 and 1, 2 and 5, 1 and 2, 2 and 4, and stops again (note that the user chose two combinations in the first sequence (1-3 and 2-4) and four in the second sequence (3-1, 2-5, 1-2 and 2-4).

The user will be tested 6 times (6 sequences) and I need to know each sequence later and compare them to know if there are equals or not. To get an equal sequence, the player has to choose the same buttons and they need to do the same number of repetitions regardless on the order the buttons were chosen. (example: bt1/bt2, bt3/bt4, stop = bt1/bt2, bt3/bt4, stop or bt2/bt1, bt4/bt3, stop).

I hope this isn't too confusing but anyway I've attached a capx with the idea of the game.

https://www.dropbox.com/s/467dcn4m23pq1 ... .capx?dl=0

Thanks in advance for any help.
B
74
S
13
G
4
Posts: 1,000
Reputation: 8,041

Post » Sat Oct 01, 2016 2:18 pm

You could have a global variable called userInput, and each button would have an input variable.

From here, you would have it so that each time a button was pressed, the input variable would be appended to userInput.

Finally, you'd be able to trigger events based on the value of userInput.

You'd have to allow the user to clear previous inputs, or do it for them automatically after set conditions, as this setup would record all inputs indefinitely.
B
59
S
21
G
9
Posts: 641
Reputation: 9,787

Post » Sat Oct 01, 2016 2:46 pm

Could you please use my example (capx) to implement your solution?
B
74
S
13
G
4
Posts: 1,000
Reputation: 8,041

Post » Sun Oct 02, 2016 5:55 pm

The main problem for me is to compare the combinations and measure the results. Can someone help me with this issue, please?
B
74
S
13
G
4
Posts: 1,000
Reputation: 8,041

Post » Sun Oct 02, 2016 6:46 pm

You can use text variables to capture the sequences (one per sequence). Once clicked each button can append its value to the variable, e.g. On Button1 clicked -> Append "1" to SequenceVariable
So, if a player makes the first sequence BTN4, BTN3 and then BTN2, BTN5 your SequenceVariable will be "4325"
Once you have all the variables, sort them (this way "4325" will be sorted to "2345") and compare.
B
28
S
10
G
10
Posts: 97
Reputation: 6,584

Post » Sun Oct 02, 2016 11:17 pm

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Oct 03, 2016 11:25 am

Thanks for your time, @99Instances2Go

It's almost that I need.

Is it possible to check all the combinations without select them and when I touch in the "check" button, the system find the equal combinations also in different order (e.g. 1-2 must be equal to 1-2 or 2-1)?

Thanks in advance.
B
74
S
13
G
4
Posts: 1,000
Reputation: 8,041

Post » Mon Oct 03, 2016 11:43 am

For (1), you should be able to do that now (based on example), for (2), it does that already.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Oct 03, 2016 12:32 pm

Ok. (1) I will try to make it. (2) Sorry. I did not pay attention. Thank you.
B
74
S
13
G
4
Posts: 1,000
Reputation: 8,041


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 11 guests