让我们将 ball 放在控制台上的随机位置。

  • 点击Python选项卡。 然后点击 ,将 Random Integer 拖动到程序中。
  • 将变量名称(等号之前)更改为 x
  • 将数字更改为 (-100, 150)

这个指令从 -100150 之间随机选择x坐标。坐标存储在名为 x 的变量中。

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

stage.set_background("halfcourt") sprite = codesters.Sprite("player4") sprite.go_to(215, -175) net = codesters.Sprite("basketballnet") net.go_to(215, 175) ball = codesters.Sprite("basketball")
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)