Color matching help (capx included)

0 favourites
  • 4 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hello, I want to do a color matching game where I need to match 5 pieces together to make a combo, the colors comes in at a sequence (always the same) and you have to fill your ball with the correct 5 colors in the correct order to do the combo things. If you collide with a color you already have, you loose that color.

    Im trying to do something like this:

    Hero collision with Bar Yellow = Change animation to Yellow

                                      Destroy bar yellow

                                      set color to 1

    Hero collision with Bar Blue = Change animation to Blue

                                     destroy bar blue

                                     set color to 2

    And so on for each of the 5 colors

    If Color = 5               Set rage visible (a red coloring thing that     covers the entire screen)

                               Change animation to full (rage animation)

                               and so on.

    But I am having trouble (as in lost, dont know what to do) about how to set up when hero hits a color it already has, to make your hero lose the color it collided with...

    Each animation adds the current color you are colliding with to the previous ones on your ball.

    Here is the capx:

    https://www.dropbox.com/s/k24ythv9tsq5d7r/Match%20Runner.capx

  • I tried:

    If Bar Blue collides with player and color=2 (the color attached to blue), set animation to *previous color* thus removing the color blue from the hero/player, But got nothing. Im lost. Please help me

  • You could have an instance variable for each colour, have them start at 0, and when you collide with a colour, set that variable to 1 (or if it is already 1, set it back to 0).

    Then if the sum of the variables is 5 you know you have all the colours.

    The trickier part is showing what colours you have, because there are a lot of possible combinations of the colours! (31 I believe). So, either you would need to have that many animations, or you would have to have one additional sprite for each colour, pinned to the player sprite, and show or hide them based on whether you have collected that colour or not.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the insight about that AllanR, I will try it now :)

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