STEP 11: Let's move Michael to these coordinates.

  • Click the GRAPHICS tab in the toolkit, click and drag out Go To.
  • Change the variable name in front of the .go_to() command from sprite to michael.
  • Replace the -100,-50 in the parentheses with michael_x, michael_y.

Click Run to see Michael move to a new random location on the stage!

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) michael_x = random.randint(-230,230) michael_y = random.randint(-230,230)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)