STEP 9: Let's fill in the add_ball() function.

  • Click on GRAPHICS. Go to and drag Soccer Ball below the docstring.
  • Change the name of the sprite from sprite to ball.
  • Go to and drag Set y Speed onto the next line. Change sprite to ball.
  • Change the number inside the parentheses of set_y_speed() to -8.

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()