STEP 17: Go to Actions and drag out Get Image Name. Rename the variable name.

  • Change the name in front of .get_image_name() to hit_sprite.
  • Inside the collision event, add another if statement and test if name is equal to "coin".
  • Use Remove Sprite to remove the hit_sprite from the stage.
  • Use Add Value to add 1 to the score and Update Display to update the score_board with the new value of score.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)