3. Play football

In this practice we are going to program two characters that will play soccer, passing a ball from one to the other.

_images/scratch3-p02-futbol.png


  1. We start the Scratch editor.


  2. Press the language button boton-idioma in the top bar and choose English.


  3. Press the tutorial button boton-tutoriales and then the animation button boton-animacion.

    We select the tutorial "Slide" and visualize it.

    Then we select the tutorial "Animate an object" and we visualize it.

    In these two tutorials we will see the basic operation of the program. Once the tutorials are finished we are going to create a program in which two characters kick a ball that moves across the screen.


  4. We delete the cat object by clicking on the trash can icon.

    borrar-gato


  5. Now we choose a suitable backdrop for our game. Change the backdrop to a football field.

    Press the button choose a backdrop seleccionar-fondo.

    We look in the Exteriors section.

    and select the Playing Field backdrop.

    _images/scratch3-fondo-playingfield.png


  6. Next we add a new character, a child.

    Press the button choose an object seleccionar-objeto.

    We look in the People section.

    and select the Ben object.

    _images/scratch3-objeto-ben.png


  7. We are going to program the initial position of the child. We move the child to the desired position and on the movement button boton-movimiento we choose the command instruccion-iraxy.

    In the appearance button boton-apariencia we choose the child's initial costume.

    _images/scratch3-p02-ben-inicio.en.png
  8. We added a new character, a girl.

    Press the button choose an object seleccionar-objeto.

    We look in the People section.

    and select the Jordyn object.

    _images/scratch3-objeto-jordyn.png


  9. We are going to program the initial position of the girl. We move the girl to the desired position and on the movement button boton-movimiento we choose the command instruccion-iraxy.

    In the appearance button boton-apariencia we choose the girl's initial costume.

    _images/scratch3-p02-jordyn-inicio.en.png

    Finally, inside the Jordyn object, click on the direction option and set the rotation to -90 degrees and from left to right by clicking on the two opposite arrows. In this way the girl will not be face up when turning in the opposite direction.

    _images/scratch3-direccion-derecha-izquierda.en.png


  10. We added a new character, a soccer ball.

    Press the button choose an object seleccionar-objeto.

    We look in the Sports section.

    and select the Soccer Ball object.

    _images/scratch3-objeto-soccerball.png


  11. We program the movement of the ball with two slides to the left and two slides to the right, following the instructions in the tutorial. The two movements on each side are used to make the ball appear to go up and down from one side to the other.

    _images/scratch3-p02-pelota-desliza.en.png


  12. Press the green flag bandera-verde to test the operation of the program.

    The ball must move back and forth between the legs of the two characters.


  13. Now we are going to coordinate all the objects by means of messages so that the children hit the ball when it reaches their feet.

    First we modify the code for the balloon so that it sends messages when it reaches each of the ends.

    _images/scratch3-p02-pelota-desliza-juega.en.png

    The message2 is achieved by clicking on a new message to create it.

    _images/scratch3-nuevo-mensaje.en.png _images/scratch3-nuevo-mensaje2.en.png


  14. We select the Ben object to add the following program.

    _images/scratch3-p02-ben-juega.en.png


  15. We select the Jordyn object to add the following program.

    _images/scratch3-p02-jordyn-juega.en.png


  16. Press the green flag bandera-verde to test the operation of the program.


Challenges

  1. Add a new character that moves around the four corners of the soccer field.

    Use the command slide in 1 second to a position.


  2. Add a new character, Casey, to play ball with the other two characters. The ball must go from one character to the next until it passes through all three characters and the cycle begins again.


  3. Add two more characters to the game from the Sports tab. One must be a Pitcher and the other a Batter. The pitcher will throw a baseball to the batter. The batter will hit the ball, which will return to the pitcher.