STEP 15: Now we can use the random variables to set a new speed for the meteors.

Since dino is assigned in the handler of this collision event, dino is called sprite and all the other sprites are called hit_sprite inside the event.

  • Inside the event, use Set x Speed to change the hit_sprite's x speed to new_x_speed.
  • Inside the event, use Set y Speed to change the hit_sprite's y speed to new_y_speed.

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)