Click the green flag to watch how two of the three sets of balls bounce off each other when they touch. See also how a star appears briefly whenever the top two balls touch.
This project in the Scratch Tips studio shows three ways of making two balls bounce off each other when they touch. Two of the ways work reliably; the third does not. The blue ball takes responsibility for detecting when it touches the yellow ball. The yellow ball and the star change their behavior whenever the blue ball announces that it's time for a bounce. The green and red balls bounce whenever they touch each other. The two purple balls attempt to do the same. However the first to detect when they touch moves away before the other can detect that they have touched.