10 步:让我们画一条从足球到网的线。

  • 找到Line并将其拖到代码编辑器的底部。
  • 将线的名称从sprite更改为line
  • 将 x-start 从0更改为ballx并将 y-start 从0更改为bally
  • 将 x-end 从200更改为netx ,将 y-end 从100更改为nety

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

stage.set_axis(100) stage.create_grid_overlay(10, "grey") stage.set_background("soccerfield") ballx = -80 bally = random.randint(-100,100) # sprite = codesters.Sprite("image", x, y) ball = codesters.Sprite("soccerball", ballx, bally) netx = 90 nety = random.randint(-100,100) # sprite = codesters.Sprite("image", x, y) net = codesters.Sprite("soccernet", netx, nety) net.flip_right_left()
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)