STEP 9: It's time to create a random x-coordinate for Michael.

  • Click the LOGIC tab in the toolkit, click and drag out Random Integer.
  • Change the variable name from my_var to michael_x.
  • Change the integers in the parentheses from 1,10 to -230, 230

This will create a random integer between -230 & 230 that we will use as Michael's x-coordinate.

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

stage.set_background("schoolentrance") stage.wait(2) stage.create_grid_overlay(50, "blue") stage.set_background_color("azure") emma = codesters.Sprite("person1") emma.set_size(0.5) michael = codesters.Sprite("person2") michael.set_size(0.5) emma_x = random.randint(-230,230) emma_y = random.randint(-230,230) emma.go_to(emma_x, emma_y)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)