Step 11: Player Eats Apple Code 2

Goal:


When the player ever touches an apple, we want our code to add a point to our score as well as broadcast eaten – which will delete the apple sprite.

Steps:

  1. From Sensing, place a touching sprite block into the IF block, set it to Apple.
  2. From Variables, place a change points by block, set it to 1.
  3. From Events, place a broadcast block and set it to eaten.

Code: