How do I compare sequences of clicked buttons

0 favourites
  • 9 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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.

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Could you please use my example (capx) to implement your solution?

  • The main problem for me is to compare the combinations and measure the results. Can someone help me with this issue, please?

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

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

  • For (1), you should be able to do that now (based on example), for (2), it does that already.

  • Ok. (1) I will try to make it. (2) Sorry. I did not pay attention. Thank you.

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