STEP 5: Let's use the same type of loop to set up four roads.

  • Create an Integer Variable outside of the loop named y with a value of -150.
  • Drag in another Loop with Range. Set the range to 4.
  • Inside the loop, add a Rectangle named road. Replace the y-coordinate with y.
  • Give it a width of 500 pixels and a height of 60 pixels. Change the color to "gray".

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)