Scratch exercise 81

Pick up an object and put it down again

In this tutorial you will create scripts that allows a character (the cat) to pick up a paint brush, carry it and then put it down again.

Complete these steps ..


1. Create a new game file.


2. Re-name the cat "Cat" and add the usual scripts for starting the game and walking ..


3. Download (right-click), save and then import this sprite/costume ..

Name the sprite "paint brush" and move the costume center point to its handle in the paint window ..


4. Create this variable (for all sprites) ..

Hide them on the stage.


5. Save your game.


6. Select the Paint brush sprite and add these scripts ..

Note that when the Cat is touching the paint brush, the key "1" is used to pick it up, and "2' is used to drop it again.

Another "if" script block ensures that the brush goes to the cat (" go to cat"), and points in the correct direction when "is brush picked up?" = Yes.


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


8. Can you improve it? Is there a better way to do this?