PASO 8: ¡Hora de hacer otra función! Vamos a crear la función que agregará la pelota al escenario.

  • Arrastra Define Function entre add_player() y main() . Cambie el nombre de esta nueva función a add_ball() .
  • Arrastra Docstring para que sea la primera línea en add_ball() .
  • Esta función agregará una pelota al escenario y establecerá sus atributos. Edite la cadena de documentación para decir esto.

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 add_player(): """ Adds a player to the stage for the user to control """ player = codesters.Sprite("player1") player.go_to(0, -155) return player def main(): """ Sets up the program and calls other functions """ set_stage() player = add_player() main()
  • Run Code
  • Enviar Trabajo
  • Actividad Siguiente
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)