1. The document describes the steps to code a basic soccer game in Scratch, including creating variables to track scores, sprites for the backdrop, ball, and two players.
2. The players can be controlled using keyboard arrows to move around the field and try to score goals by getting the ball in the opponent's net.
3. Additional challenges are provided like customizing the starting positions and controls for the second player.
1. The document describes the steps to code a basic soccer game in Scratch, including creating variables to track scores, sprites for the backdrop, ball, and two players.
2. The players can be controlled using keyboard arrows to move around the field and try to score goals by getting the ball in the opponent's net.
3. Additional challenges are provided like customizing the starting positions and controls for the second player.
Button Start – show, hide and broadcast Step 1. When Greenflag clicked, Button start must Show and at middle using Go to. 2. We can set size to 100% (you can set the size by yourself). 3. Creating animations with Forever, Set Size and Wait seconds. 4. When the play button is pressed, the play button will Hide and send Broadcast Play. Code Backdrop – Create variable and Switch Step 1. Create 2 variables whose names are player 1 and player 2. 2. When Greenflag clicked, Change backdrop to Backdrop Play (Soccer Field). 3. Then take set player 1 to 0 and set player 2 to 0, place it under the previous code. 4. Then take show variable player 1 and show variable player 2. Code Ball – Create variable and Show & Hide Step 1. Create variables whose name is Speed. 2. When Greenflag clicked, ball will Hide. 3. When receive play, ball will Show. 4. Take set size to 30 % (you can set by yourself). 5. Take Go to front layer. 6. Then Set speed to 0 and Put ball 1 in middle using go to x y. Code Player 1– Show and Control Step 1. When Greenflag clicked, player will Hide. 2. When receive play, player will Show. 3. Take set size to 50 % (you can set by yourself). 4. Change direction to 90. 5. Set rotation style to left-right. 6. Put player 1 in the starting position using go to x y. The x and y positions of player 1 depend on your sprite. Player 1– Show and Control Step 7. Take forever and create 4 conditions for player movement. • If key A is pressed, then change direction to -90 and move 10 steps. This code is for players walking to the Left. • If key D is pressed, then change direction to 90 and move 10 steps. This code is for players walking to the Right. • If key S is pressed, then change direction to 180 and move 10 steps. This code is for players walking to the Down. • If key W is pressed, then change direction to 0 and move 10 steps. This code is for players walking to the Up. Code Player 2– Show and Control Challenge for player 2 1. Do the same steps with player 1. 2. Choose the starting position for player 2. 3. Change keyboard controls for player 2, for example using right arrow, left arrow, etc. Q&A