Discuss Scratch

GABOCK
Scratcher
8 posts

If two sprite's clones collide, can both of them detect the collision

I have several clones of two sprites A and B that move and can collide. When a clone of A meet a clone of B, I need to delete both of them.
It seems that one of them receive the signal (if touching) then get deleted but the other one do not receive any signal.
I can not broadcast a message because it would not identify the clone that is concerned by the collusion.

Thank you for your help.
mstone326
Scratcher
1000+ posts

If two sprite's clones collide, can both of them detect the collision

Here is a quick example. Have one clone detect the touching and broadcast, but in the broadcast use an if statement if touching the other clone then it will only delete that one and not all of them.

https://scratch.mit.edu/projects/469006443/
GABOCK
Scratcher
8 posts

If two sprite's clones collide, can both of them detect the collision

Thank you. It works quite well. Anyway, sometimes, one clone A touches several clones B at the same time and, in my project, this is a problem.

Here is my project :
https://scratch.mit.edu/projects/469191212/

clones A are bullets. clones B are asteroids. when A touches several B, each B get destroyed and the user gets a special message (double hit). For that clones A increment a counter for the number of asteroids it has destroyed. I noticed that when 2 asteroids are close to each other, the counter is only incremented by 1. Do you think there is a way to avoid this ?

Powered by DjangoBB