Step 7: Hard Target Movement/Reset

Goal:


Let’s finish by coding the hard target in our game.

This code is also very similar to the other targets that we coded with some small differences.

What are they this time? Why are they there?

Steps:

  1. Click on the “Hard Target” sprite
  2. From Control, place a when flag clicked block
  3. From Motion, place a set y to block and change the number to 150
  4. From Looks, place a show block
  5. From Control, place a forever block
  6. From Motion, place a change x by block and set the number to 10
  7. From Control, place a if block
  8. From Sensing, place a touching edge block
  9. From Motion, place a set x to block then set the number to -220.

Code: