It could be either or both---sprites do not appear to have priority. Whechever script happens to be scheduled first would take priority. Whether the other script fired or not depends on a race condition (does it manage to detect the touching before the movement brings them apart?)
You should not write code that depens on consistent behavior of race conditions.
Offline
owowo wrote:
Say two sprites move away if touching each other. Which sprite takes priority? I suspect only one of the sprites actually is executed as touching. Which one?
I wrote a simple example project to demonstrate how to handle the collision of two sprites: http://scratch.mit.edu/projects/delza/291
Basically, whenever either of them detects a collision, it sends a broadcast message. Then the sprites turn away when they receive the broadcast, rather than when they collide. Otherwise, as you've found, one sprite will detect a collision and turn away, then the other will test for collision, but they aren't colliding anymore, so instead of turning it will follow the first sprite (or continue on it's way, depending on which way it was heading).
I hope that helps.
--Dethe
Offline
Is there not a risk, there, of them both noticing the touch, and the message getting broadcast twice, causign them to turn 180 and turn back again?
Offline