Step 6: All Target Broadcast Message

Goal:


To finish up our game, we need to activate everything we coded during this part. We can fire off these events when we hit the targets by using an If statement.

If the Laser touches a target, then we want to broadcast the message that will run the code to add a score and reset the targets.

After this the game is complete. Have fun with it and see if you can think of anything else to add to it!

Steps:

  1. Click on the “Laser Sprite” and find the “when I start as a clone” block
  2. At the very bottom of the last If statement block (the if touching edge block), from Control, place an If statement
  3. From Sensing, place a touching mouse-pointer block and change it to touching EasyTarget
  4. From Events, place a broadcast EasyScored! block
  5. From Control, place a delete this clone block
  6. From Control, place an If statement after the last If statement
  7. From Sensing, place a touching mouse-pointer block and change it to touching MediumTarget
  8. From Events, place a broadcast MediumScored! block
  9. From Control, place a delete this clone block
  10. From Control, place an If statement after the last If statement
  11. From Sensing, place a touching mouse-pointer block and change it to touching HardTarget
  12. From Events, place a broadcast HardScored! block
  13. From Control, place a delete this clone block

Code: