STEP 14: We'll want to track each time there is a collision so we can keep score, but variables created OUTSIDE of an event or function can't be changed INSIDE an event or function. We can use the Python keyword global to make an exception to this rule. global lets us use a variable inside and outside of an event.

  • Delete the .go_to() and .hide() commands that are inside the collision event.
  • From LOGIC, drag Global Variable INSIDE the collision event. Change the variable to score.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE