Course E Sprite Lab when touches

I have a student who is trying to have a sprite bounce back and forth. The first “when touches” works but when it (coin) goes back to touch the next Sprite it won’t follow the “when touches” for the 2nd one.

@heather.caster
Sometimes this happens if the wrong sprite is selected from the drop-down. Use the ‘Share’ button from the top ribbon to copy the link to the app. When you post the link here, someone can take a look and pinpoint the bug.

Thanks, Andrea

I also tried doing a project on my own with the same code/events and it did the same for me

@heather.caster

I noticed that your code for the details of the behaviors was edited so that it goes east by 5 pixels and west by 10 pixels. A specific behavior will continue until stopped or its details are changed. When the ball touches the boy on the right, it keeps moving 5 east while also going 10 west. To our eye, it is only moving to the west because 10 >5. When the ball touches the boy on the left, it continues moving west because the west behavior is not stopped and the details of the east behavior is not changed. The behavior do not ‘stack’ e.g. two move 5 pixels east does not equal one move 10 pixels east.

I was able to get the ball bounce between the two sprites by stopping the old behavior before adding a new behavior.

Hope that helps!

Happy computing, Andrea