Scratch exercise 52

Football striker - intermediate

It this exercise you will create a game in which a striker must get past a defender to score a goal.


1. Create a new Scratch game .. File>New ..


2. Select the cat sprite underneath the stage delete it.


3. Click on these 2 costumes for your players, save them to your computer (desktop?) and import them into Scratch ..

Open them in the paint window and change the colour of the shirt and shorts ..

Name this sprite "Striker".


4. Duplicate (copy) Striker, change the colour of the shirt and shorts and rename it "Defender 1".


5. Now paint a ball. Use the circle tool and hold down the shift key to draw a perfect circle ..

If you like you can import an image of a real ball. If you do, then copy it's costume and rotate each so you can simulate it rotating when kicked ..


6. Save your game.


7. Add these scripts to the Striker ..

Press the "B" key to test your scripts. Press the "E" key to stop and continue work on your game.


8. Add these scripts to the Defender ..


9. Create a new variable "For all sprites" named "ball speed" and hide it.


10. Add these scripts to the ball. You may need to adjust the "set size" script block value ..


11. Next, paint your stage background to look like a football pitch.


12. Now paint a new sprite for the goal posts. It could be a simple line. Rename it "Goal posts". Position it on the goal line ..

Add this script to it ..


13. Paint a new sprite. Choose a bright colour and use the text to create a sprite that says "GOAL!!!" ..

Add this script to it ..


14. Press the "B" key to start your game. Move your mouse on the stage and practice kicking the ball.


15. Press the "E" key to stop your game.


16. Well done. You've finished. Now save your game using "File>Save as". Remember to give it a name you will remember like "Kick ball".


17. Can you add a scoring system? Or alternatively, complete the Striker-Advanced Challenge.