In this tutorial, we’ll explore how to create collectible items in Scratch, allowing players to gather objects while exploring your projects. Let’s dive right in and give your characters the ability to collect treasures!
First, select a character and a background for your project. Then, choose an item that your character can collect, such as a star. To make the item respond to interactions, drag the “start sound” block from the sound category onto the item’s script. This will play a sound when the item is clicked.
Next, let’s make the item disappear when collected. Drag the “hide” block from the looks category onto the item’s script. This will make the item vanish when clicked. To make the item reappear when the game starts, drag the “show” block into the script and set it to be triggered when the green flag is clicked.
Finally, let’s add movement to your character using the arrow keys. Drag the “change X by 10” and “change Y by 10” blocks from the motion category onto the character’s script. These blocks will enable your character to move right and up when the corresponding arrow keys are pressed. To make the character move left and down, use negative values in the blocks.