Unit 3, lesson 20 help


I would like to have my hurdle_down sprite appear when the runner bumps into a hurdle. I have tried to use sprite.visible and turn in true when the collision happens. However, the hurdle_down sprite appears off the screen. What can I do to make it switch places with the hurdle sprite at the point of contact?

[Code.org - Game Lab]

Hello @heath.kelley,

Yes, your solution was “working” but then the hurdle_down sprite was immediately placed randomly off the screen and couldn’t be seen.

Here is how I broke down the problem:

  1. Continue having hurdle randomly placed off the screen so it can scroll back in.
  2. If the runner isTouching the hurdle, Make hurdle_down visible=true at the same x & y of the runner.
  3. If hurdle_down animates off the screen, make its visible = false but return it to the position of the runner so when it appears again it is in the correct place.

Here is my solution. I think this is what were aiming for and I think the scoring still works as intended.

Happy Summer!