Multiple actors colliding with another actor

JarrenHJarrenH Member Posts: 206
So i've got anywhere between 1 and 5 copies of this actor. Lets call him "Ball".
Each level has a various amount of balls, and my code figures out how many balls are on that particular level.
The goal of the balls is to get to another actor, which we will call "Goal"
How can I code either the balls or the goals to know when all are touching each other?

Comments

  • ORBZORBZ Member Posts: 1,304
    create a game variable called sum
    every time a ball actor collides with goal add 1 to the sum. When the sum = 5 then you know that all 5 balls are in the goal.
  • JarrenHJarrenH Member Posts: 206
    create a game variable called sum
    every time a ball actor collides with goal add 1 to the sum. When the sum = 5 then you know that all 5 balls are in the goal.
    Sorry, forgot to add that these balls can leave the goal, and thus need to subtract from the total that is in the goal.

    I ended up assigning an index to each ball, and then when the ball collides with the goal sets its index to 1. Then the goal constrains a seperate attribute to add up the totals of all the indexes. And when the totals equal the amount of balls, the level is complete.

    And anyone who understands the above gets a virtual cookie!
Sign In or Register to comment.