10 步:让我们移动我们的篮球,所以当点击我们的球员时,它会出现在我们的球员附近。

在 Python 中,缩进很重要!如果你的代码没有正确缩进,那么你会得到一个错误!

  • 前往工具包的部分,然后将Go To拖到您的单击事件内的程序中。
  • .go_to()命令中的第一个数字更改为-175并将第二个数字更改为-125
  • .go_to()命令前面的名称更改为ball

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

stage.set_background("halfcourt") sprite = codesters.Sprite("player1") sprite.go_to(-175, -150) net = codesters.Sprite("basketballnet") net.go_to(215, 175) stage.set_gravity(10) sprite.set_gravity_off() def click(sprite): ball = codesters.Sprite("basketball") # add other actions... sprite.event_click(click)
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)