第 6 步:我们的精灵在同一个地方!让我们创建随机的 x,y 坐标来放置我们的精灵。

  • 单击工具包中的 LOGIC 选项卡,单击并拖出Random Integer
  • 将变量名从my_var更改为emma_x .
  • 将括号中的整数从1,10更改为-230, 230

这将创建一个介于 -230 和 230 之间的随机整数,我们将用作 Emma 的 x 坐标。

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