STEP 11: There's one more thing we need to do. We need to keep track of which number particle we are up to. This will be very important later, when we want to see every particle of every color.

  • From drop Add Value inside the new loop. It should be indented twice!
  • Change my_var to count. This tells us which particle we are up to. We will add one to this number, and use it later to pause between colors so that we see the whole firework.

To navigate the page using the TAB key, first press ESC to exit the code editor.

stage.set_background_color("black") amount = 10 speed = 5 color_list = ["purple", "yellow", "red"] stage.disable_all_walls() def click(): x = stage.click_x() y = stage.click_y() particle_list = [] for color in color_list: for counter in range(amount): sprite = codesters.Circle(x, y, 10, color) particle_list.append(sprite) angle = 0 for count, p in enumerate(particle_list): pass # add other actions... stage.event_click(click)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)