Scratch game making tutorial 102

Ping pong

In this tutorial you will a version of the old 2 player ping pong game. Each player will have a paddle and attempt to return the ball without it hitting their end zone.


Complete these steps ..


1. Create a new game (From the top menu choose File>New).



2. Right-click the cat thumbnail (sprite1) under the stage to delete the cat sprite.



3. Download and save these sprites (right-click), then use the "choose new sprite from file" button under the stage to add them to your to your game ..



4. Download and save this background image, then use the "import" button in the "backgrounds" tab of the stage to import it ..




5. Staying on the stage, select the Scripts tab and then add these scripts to the stage ..



6. Add these scripts to the "How to play text" sprite ..



7. Test your game. Press the "B" key to begin and show the "how to play" sprite, and then the space-bar to hide them.

If this works fine, use "File>Save as" to save your game. Name it "Ping pong".



8. Add these scripts to "Paddle 1" ..



9. Duplicate the "paddle 1" scripts to "Paddle 2" and edit the "go to x" value so this paddle is positioned on the right side of the stage, and the "key pressed" scripts so that player two can use the up and down arrow keys to control their paddle ..

Now press "B" then the spacebar to test that the paddles are positioned correctly. Use the "W", "S", "Up arrow" and "Down arrow" keys to text they are moving correctly too.



10. Select the "Ball" sprite and then create these variables ("for all sprites") ..

Right click them on the stage and select "large readout", then position them like this ..



11. Now add these scripts to the ball (you do not need to add the comments) ..



12. Use "File>Save" to re-save your game.



13. Well done, you're finished! Press "B" to test your game.



14. Can you you improve the game by adding your own mods? How about adding ..