How to make it so 3 of the same actors that touch destroy
![Oakes games](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Ive been making a game Sort of like drop3. Im trying to make it so that when 3 or more of the same actor touch the actors that touched destroy themselves. Ive been trying to make it work for like 3 days now and really need some help thank you in advanced!
Answers
I am going to try and help. Here it goes:
First, for simplicities sake, I am going to call your first set of actors "apples." The second set, we will call "oranges."
Create an index variable "applestouch" or something to that liking. It will keep track of how many apples are touching your oranges. Make sure to constrain it to the total number of apples you have on screen.
Now create a rule INSIDE YOUR OBJECT with the parameter "collides" with whichever actor you want to keep track of touching your apples. If it is other apples then it should read:
actor receives event collides with apples
or
actor receives event collides with oranges
in this rule have a change attribute that add + 1 to your touch variable
applestouch = applestouch + 1
the NEXT STEP IS IMPORTANT
in the OTHERWISE section of the rule, do the opposite. Meaning, when they are not touching, subtract one away from your applestouch.
applestouch = applestouch - 1
Because we are adding and subtracting INSIDE your object, each object will subtract one away from your total, just by spawning and by NOT touching oranges.
This may add more than one if one apple is touching multiple oranges, but I think that is OK for what you are trying to accomplish.
Anyways, I hope this helps. Good luck!
Sincerely,
Charles