1. ## What to do about a simultaneous collision?

Hi

I have a problem with a simultaneous collision as follows:

• I have 5 players and 5 boxes.
• Each player must collect a box.
• When each player has collected his box, the level ends.
• Everything is moving at a reasonable speed

The Code is:
• when the player overlaps the box I subtract 1 from a variable
• delete box & player
• when the variable = zero the level ends.

Now what happens on rare occasions is that 1 player will run into 2 boxes at the very same split second.
The boxes can also be overlapping each other when the player runs into them - so literally it is the very same split second.
In this case the level will still end normally as they both will deduct 1 from the variable and the player and both boxes are deleted.

But then there is a player left in the level without a box.

And well, I just don't want 1 player to be able to collect 2 boxes.

But I don't have any ideas on how to prevent this.

Any suggestions?

Thanks

2. Without seeing the MFA its hard to say but I might try to add a condition for only one action when conditions loop on the collision to see if that has an effect.

3. You can use the condition "Pick one of Box" found in "Pick or Count" to only work on one box in one event (therefore, the player won't accidentally collect 2 boxes)

4. Thanks Jeff & BartekB

@BartekB - I don't know how I would incorporate your suggestion into a collision event.

I had: Player 1 collides with a "Group.Boxes" - and I've now seen that if I split that to say Player 1 collides with Box 1 and then Player 1 collides with Box 2 etc. then 99% of the time it won't take both boxes - even when I placed the boxes virtually on top of each other.

(It did only once take both boxes anyway...)

5. like so:

6. Thanks a lot.

That's an awesome illustration

7. I had this as follows:

Collision between Player and Qualifier (group.boxes)
Pick one of Qualifier (group.boxes)

But this now will pick a box at random - that may or may not be in collision with the player.

So I can't use this.

8. This doesn't sound right.

The following boxes get scoped with the Collision, then out of all of them that have been scoped, only one is picked...
Can you send an mfa or upload a screenshot of the condition?

9. It seems it works to me, just use overlap instead of collision (to keep scope). Give a look to the example attached.

10. I had a look at your example, thanks faber, but the conditions / movements aren't the same as in my game.

Attached is an example of approximately the code I'm using for the movements and the exact code for the collision.

It often destroys one of the stars that isn't in the collision. But not every time - so you might have to run it a few times to see it.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•