STEP 11: We already set up the probability part. Now let's change the variable name and image label!

  • Name the sprite new_object.
  • Change it's image to "coin" and position it at (rand_x, 260).

Now we have a 50% chance that a coin will appear. 51-100 is 50% (half) of the numbers in the rand_chance range.

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)