STEP 3: Let's add the roads. All the roads will be the same except for their y-coordinates.

A list can store multiple pieces of data, like numbers!

  • First, copy or type this code onto the next line in the code editor: my_list = [-150, -50, 50, 150]
  • my_list contains the y-coordinates for our roads! We'll make the roads next by using a loop.
  • In the LOGIC tab and the toolkit, drag out Loop through List onto the next line.

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

# sprite = codesters.Rectangle(x, y, width, height, "color") start = codesters.Rectangle(0, -250, 500, 50, "red") # sprite = codesters.Rectangle(x, y, width, height, "color") finish = codesters.Rectangle(0, 250, 500, 50, "green")
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)