STEP 15: We need to be able to change the value of score and lives when the car collides with specific sprites.

  • Drag Collision with Shape to the bottom of your program and assign the event to car in the event handler.
  • Drag Global Variable to the top the event, ABOVE the if statement, and change the variable name to score.
  • Drag another Global Variable to the line right below score. Change the variable name to lives.

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)