You can have two different sorts of variables: Local and Global. Use global for a variable that can be used by all sprites. Use local for a variable that just relates to a particular sprite.
In this example we will start with the Fish Chomp game that comes with Scratch. Choose Open, go to Games, and choose FishChomp. We will keep score of how many fish have been chomped.
Go to the Variables tab, and click Make a Variable. Choose a global variable and name your variable FishEaten. It is always a good idea to give your variables meaningful names.
If you want to see your FishEaten score as you play, tick the box to the left of the variable name.
![]() |
Now for each of the 3 gold fish, in their scripts add in a block 'Change FishEaten by 1' straight after the Broadcast got-me block. Now as you play the game and chomp fish, you should be able to see how many you have eaten. |
![]() |
|
Let's further improve the Fish Chomp game by stopping it whenever the
player has chomped 10 fish. Add in the following to the stage
script:

Finishing Off the Game
We can further improve the game by adding in another background for the Stage that says 'Game Over'. Just copy the existing background and add in the writing.


Add the following into each of the 3 goldfish and the big fish

Add in the following to the Stage script:

![]() |
|





