第 5 步:让我们继续设置游戏。接下来我们需要添加一个您将控制的播放器!

  • 并拖入Define Function 。将它set_stage()main()之间。
  • 将新函数重命名为add_player() 。确保新函数定义没有缩进!
  • 接下来,将Docstring拖到新函数中,使其在第一行缩进。
  • 将文档字符串编辑为""" Adds a player to the stage for the user to control """

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

def set_stage(): """ Sets up the stage for the game """ stage.set_background("soccerfield") stage.disable_floor() def main(): """ Sets up the program and calls other functions """ set_stage() main()
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)