My 10-year-old was asking how to have sprite detect when they collide. There are two parts to the answer.
The first part is to use the sensing block "touching (other sprite)", although you could also use "distance to (other sprite)"
The second part is when you want both sprites to detect the collision. The problem I encountered was that one sprite would detect the collision, turn and move away, before the other sprite sensed that they'd collided. This wouldn't be a problem in some circumstances, and I could have solved it by re-ordering when bouncing and moving happened, but instead I used the control block "broadcast (message)" to send a bounce message, then both sprites turn when they receive this message.
A simple example that I hope helps someone.
Comments
You need to be logged in to post comments
Add a Comment
I downloaded it & exported both cats. I import the cats in nearly every project!!! Thanks for the help!