Color matching help (capx included)

Get help using Construct 2

Post » Tue Feb 11, 2014 5:20 pm

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.capxFrostolo2014-02-11 17:27:48
B
12
S
3
G
1
Posts: 79
Reputation: 1,055

Post » Tue Feb 11, 2014 5:54 pm

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
B
12
S
3
G
1
Posts: 79
Reputation: 1,055

Post » Tue Feb 11, 2014 6:44 pm

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.
B
95
S
33
G
20
Posts: 438
Reputation: 17,640

Post » Tue Feb 11, 2014 7:01 pm

Thanks for the insight about that AllanR, I will try it now :)
B
12
S
3
G
1
Posts: 79
Reputation: 1,055


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 29 guests