Today, we will make a fun Halloween game in Scratch. A ghost will chase bats around the screen. Every time the ghost catches a bat, you get a point. It will be spooky and fun! Let's start our adventure.
Go to the Scratch website to make a new project. Click here: https://scratch.mit.edu/. Delete the cat sprite because we do not need it.
Go to the Scratch website using the link below and click on the 'Create' link in the blue bar at the top.
By default, each new project starts with the cat sprite already added. To delete the cat click on the x in the blue circle beside the cat in the sprite list.
Find the 'Ghost' sprite in the Scratch library and add it to your project. The ghost will be the chaser!
To add a sprite from the sprite library follow these steps:
You can use search box or the filter links (Animals, People, Fantasy etc) to locate your sprite.
Now, make the ghost small and let it follow your mouse. This way, you can move the ghost to catch bats.
Add this code to the Ghost sprite:
when green flag clicked
set size to (30) %
forever
point towards (mouse-pointer v)
move (5) steps
Before we start, let's understand what a variable is. Think of a variable like the score in a football match or the health bar in a video game.
It's a number that can change depending on what happens in the game. In our game, we will use a variable to keep track of the score. Every time our Ghost catches a Bat, we will add one to the score.
In the Variables palette, create a new variable by clicking the 'Make a Variable' button.
Once you click this button a box will appear asking what you want to call your variable. Give it a name that reminds you what you will be using it for. For example, if you wanted to keep track of your score in a game, you would create a variable called 'score'.