Scratch games making tutorial 62

Rock paper scissors

In this tutorial you will make a rock-paper-sissor game. In the game you play against the computer.

You will be able to see how many games have been played and how many wins you have scored.

 

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

 

2. Delete the cat sprite.

 

3. Click on the stage thumbnail and create these variables "for all sprites" ..

Arrange the 3 visible variables on the stage like this ..

Now add these scripts ..

 

4. Download and save these 2 sprites and then import them into your game ..

Ensure they are named "You" and "Computer". Each sprite has 4 costumes which will change during the game. Go and look at them now.

 

5. Save your game using File>Save as. Call it "Rock paper scissors".

 

6. Now you will create three buttons so you can choose rock, paper or scissors at the start of each contest.

Create a "ROCK" button with 2 costumes like this ..

Name it "Rock button".

 

7. Add these scripts to the "Rock button" ..

Your will need to choose an appropriate value for your size script block.

When clicked, this button will start a contest, choose "rock" as your "You" contest costume, and then hide until the contest is over.

 

8. Save your game again using File>Save.

 

9. Duplicate the "Rock button" sprite and re-name it "Paper button". Edit its costumes to read "PAPER".

Edit it's scripts to this ..

 

10. Now duplicate the paper button and re-name it "Scissors button". Edit it's scripts to this ..

 

11. Save your game again using File>Save.

 

12. Add these scripts to to the You sprite (white arm) ..

 

13. Add these scripts to the Computer sprite (brown arm) ..

Notice that the Computer sprite scripts are slightly different and simpler than the You sprite scripts.

 

14. Save your game again using File>Save.

 

15. Now you need to create the scripts that record who has won. These scripts have to account for every possible outcome (9 possibles). They do this by comparing the costume numbers of the You and Computer sprites..

Click on the stage and add the 3 "when I receive score game" scripts below ..

 

16. You're done! Save your game using "File>Save".

 

17. Press "B" to start the game and then click the Rock, Paper or Scissor button to start a contest. Press "E" to end.