STEP 12: We want there to be a 25% chance for a rock to appear, so we'll assign it numbers 26-50.

  • Go to and drag if and inside the interval event, but outside the other if statement.
  • Test if rand_chance is less than or equal to <= 50 and if rand_chance is greater than > 25.
  • Drag a Sprite at Position inside the new if statement.
  • Name this sprite new_object. Change it's image to "rock" and position it at (rand_x, 260).

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)