Destroy objects when 3 of the same connect?

  • Hi There, first time posting on the forums. I have searched the forums looking for an answer to my question, and am not sure I am correctly stating the search terms to find an answer so I am posting this.

    The situation:

    There are two types of circles, one is red, one is blue.

    When the circles come in contact with one another, no matter the color, they stick together.

    When a circle contacts another circle of the same color that is through direct touch in contact with a third circle of the same color, these circles will destroy themselves.

    As an example, think of puzzle bobble. When you shoot one of the balls into a chain of balls the same color as it, they explode, but just two balls of the same color touching does not make them explode.

    <img src="http://images6.fanpop.com/image/photos/33200000/Puzzle-bobble-puzzle-bobble-33252167-300-210.jpg" border="0" />

    The problem:

    I can make the circles all stick together, but how can I make it so that the circles know when they have direct contact with three or more of their same color to explode?

    I have successfully made them explode when two of the same color attach, but that is through very simple means of making them destroy themselves when they touch themselves.

    I don't know if this is possible, but if it is and someone can point me in the right direction i'd be very grateful.

    Thanks for your time and hopefully thanks for not making any balls touching each other jokes.

    -adam

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi, you can use "is overlapping at offset" condition, and then check for colors or values, or have an invisible sprite that checks the value of the balls overlapping with it.

    This was my first game, you have to click where 3 or more of the same color are next to each other, same principle but it waits for the "click'

  • Thanks for the replies guys, I am going to dig through these suggestions and try to make something work for my test concept. :)

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