How do I set up a "Best of Three" match system?

1 favourites
  • 3 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • I have been working on a 2D fighting game. I failed to find a clean way to set up the events for a "Best of Three" match system. The system should fulfil the following criteria:

    1. Winner of the round needs to be displayed (An event so I can trigger spawning a few objects)
    2. After the layout resets the winners of the previous rounds still need to be visible
    3. After a player has won two rounds (no matter the order) the match ends

    The following screenshot of my event sheet is a possible solution that I came up with on the fly but I dislike how repetitive the code is.

    What I need is a simple solution to add up and compare the wins of each player and end the match once they have won.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • At end of round set global var 'Winner' to C or L

    If 'Winner' = C, spawn C objects, else spawn L objects

    For rounds you could use more global variables or an array to store the winners.

    In an array 1,0 would be round 1. 2,0 would be round 2.

    With the array as size 1,1 you can push the winner C or L to the back of the array.

    You could use that logic to display the winner C or L based on item pushed and link the X so 1,2,3 etc to the round display. The reason I mention arrays is because you can easily alter it in future if you want best of 5 whereas global variables would mean well more global variables and not really minimising code.

    For number of wins, you can again use global vars or an array.

    2 global vars Cwin and Lwin, if winner = C add 1 to Cwin else add 1 to Lwin

    Or using an array you search for how many times C or L appears.

    If Cwin = 2 then game end with C winner or if Lwin = 2 then game end with L winner, or using an aray if C found more than once then C = winner etc

    At start of round set 'Winner' to ""

  • Thank you for the detailed and quick reply. This has helped me immensely.

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