Scratch exercise 77

Tool select - from an inventory

In this tutorial you will create scripts that allow you to select a tool for a character, from an inventory.

Complete these steps ..

 

1. Create a new game file.

 

2. Click on the stage and add these scripts ..

 

3. Create these variables (for all sprites) ..

Hide them on the stage.

4. Re-name the cat "Cat" and add these scripts ..

 

Now, open each cat costume in the paint window and move the sprite center point to the cats hand.

 

5. Paint a new button sprite that the player will use to hide and show the tool inventory ..

The font we used was 14pt Arial.

Name this costume "show" and name the sprite "Show hide tools".

Now copy the first costume using the copy button and edit it to look like this ..

Name this costume "hide". You should now have ..

Add these scripts to it ..

Notice that the "tools select y-pos" variable is used to re-position the tools in the inventory (bottom of screen) when they are not being used.

 

6. Save your game.

 

7. Download, save and import each of these individual sprites/costumes ..

 

 

 

Name the sprites "Hammer", "Paint brush" and "Saw" and then move each sprite's center point in the paint window to the handle ..

 

8. Add these scripts to the Hammer ..

 

9. Add these scripts to the Paint brush ..

 

10. Add these scripts to the Saw ..

 

11. Save your game again.

 

12. Paint a simple text sprite words "Click tool to select" ..

The font we used was 14pt Arial.

Place it just above the tools on the stage and then add these scripts ..

 

13. You're done! Save your game again and then press "B" or click the Green Flag to test your game.

 

14. Can you improve it?