# Object Count

Get help using Construct 2

### » Wed Feb 19, 2014 10:23 pm

Instance Variables
Boolean: Red1 touching Red2 (R1R2) = false
Boolean: Red1 touching Red3 (R1R3) = false
Boolean: Red2 touching Red3 (R2R3) = false
-----------------------------------------------------------------
IsColliding(Red2) with (Red3) - Set R2R3 (true)
Else R2R3 (false)
IsColliding(Red1) with (Red2) - Set R1R2 (true)
Else R1R2 (false)
IsColliding(Red1) with (Red3) - Set R1R3 (true)
Else R1R3 (false)

Then you will want to do something like this:

R1R2(true) - Red1.destroy, Red2.destroy, Red3.destroy
(condition) R2R3 (true)
(condition) R1R3 (true)
B
6
S
2
Posts: 19
Reputation: 547

### » Sat Feb 22, 2014 3:52 pm

I do not understand some things that you put up, you can explain it better.
It took all day yesterday trying
B
11
S
5
G
1
Posts: 410
Reputation: 2,802

### » Sat Feb 22, 2014 8:57 pm

give those balls instance variables.

1. ball color (as u wish)
2. ball collision (number) = 0

If the blue ball collides with another blue ball make the "ball collision" instance counting up.
If the ball collision is 2 them destroy them.

The next steps are depending on your game design, so i can't say exactly how u have to do it.
But i think you need a every second event which decreases the ball collision number by 1 when its higher than 0.
B
9
S
2
G
1
Posts: 14
Reputation: 1,180

### » Sat Feb 22, 2014 10:33 pm

I made this several days ago but was hoping you would try to work through the example yourself so you can figure out what's going on, and ask specific questions about where your attempts failed so we can help you understand the logic and make you a bit more independent .

Since that hasn't happened, here's the cap (only done for the red blocks), hopefully that's enough to get you going enough to be able to make any other modifications on your own.

Any 3 or more red blocks that touch together in any sort of formation (they don't all have to touch each other, just be part of a connected group) are destroyed, and a new red block forms at a location of their average X and average Y

https://dl.dropboxusercontent.com/u/308 ... merge.capx
B
11
S
2
G
3
Posts: 283
Reputation: 1,968

### » Sun Feb 23, 2014 5:43 pm

Thanks for everything
B
11
S
5
G
1
Posts: 410
Reputation: 2,802

Previous