PASO 9: Completemos la función add_ball() .

  • Haga clic en GRÁFICOS. Ir a y arrastre Soccer Ball debajo de la cadena de documentación.
  • Cambia el nombre del sprite de sprite a ball .
  • Ir a y arrastre Set y Speed a la siguiente línea. Cambia el sprite a ball .
  • Cambia el número entre paréntesis de set_y_speed() a -8 .

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 add_ball(): """ Adds a ball to the stage and sets its attributes """ 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)