第 11 步:让我们将迈克尔移动到这些坐标。

  • 单击工具包中的 GRAPHICS 选项卡,单击并拖出Go To
  • .go_to()命令前面的变量名从sprite更改为michael
  • 将括号中的-100,-50替换为michael_xmichael_y

点击跑去看看迈克尔移动到舞台上的一个新的随机位置!

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
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)