Hi. I downloaded this, copied out code and made it do what I wanted when it collides, and then, it didn't pick up on collisions. I did everything you said, and your collision detection works on my PC, but mine doesn't. I'll tell you my code if you need it, as well as the sort of game and the OS. Please tell me what I'm doing wrong!
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
Hi. I downloaded this, copied out code and made it do what I wanted when it collides, and then, it didn't pick up on collisions. I did everything you said, and your collision detection works on my PC, but mine doesn't. I'll tell you my code if you need it, as well as the sort of game and the OS. Please tell me what I'm doing wrong!
I downloaded it & exported both cats. I import the cats in nearly every project!!! Thanks for the help!