第 7 步:我们将按照相同的步骤创建一个随机y 坐标

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

这将创建一个介于 -230 和 230 之间的随机整数,我们将用作 Emma 的 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)
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)