How to make counters and variables in Scratch
Making counters and variables in Scratch means creating a variable that stores a number and changing it with blocks as your project runs. A score counter and a money counter work the same way: one variable holds the value, and blocks add to it or take from it. The steps below cover creating the variable, displaying it, and updating it when something happens in your game.
Create and name your variable
A Scratch variable is a named container that holds a value while your project runs. Open the Variables category in the block palette and choose Make a Variable, then give it a clear name such as score or money. Pick For all sprites if every sprite should read and change the same value, which suits a game score. Pick For this sprite only when one sprite needs its own private copy.
Show the value on the stage
A variable can appear on the stage as a small readout so the player sees the score or money total. Tick the checkbox beside the variable name in the Variables category, or use the show variable block. Drag the readout where it does not cover important parts of your game. The hide variable block removes it when the counter is not needed.
Change the counter with blocks
The change block adds a number to a variable, and a negative number subtracts from it. Use the set block to reset the score or money to its starting value at the beginning of a game. Place these blocks inside events such as when a sprite is clicked or when two sprites touch. The money counter and score counter follow the same pattern, so one skill covers both.
Scratch Counter Questions
How do I make a score counter in Scratch?
A score counter in Scratch is a variable that you create in the Variables category and update with blocks. Set the score to zero when the game starts, then use the change block to add points when the player succeeds at something. Tick the checkbox to show the score on the stage so the player can watch it rise.
How do I make a money counter in Scratch?
A money counter in Scratch works exactly like a score variable, holding a number that goes up and down. Create a variable named money, set it to a starting amount, and use change blocks to add earnings or subtract spending. Show the variable on the stage so the player can see the current total during play.
What is the difference between a score variable and a money counter?
A score variable and a money counter are both Scratch variables, so the blocks that control them are the same. The difference is in how your game uses the number: a score tracks progress, while money might be spent on items. Naming each variable clearly keeps your block coding easy to follow.
Why does my Scratch variable not change on screen?
A Scratch variable that does not change on screen is hidden or is not being updated by any block. Tick the checkbox beside its name in the Variables category to show it, or add a show variable block. Check that a change or set block actually runs inside an event such as when the green flag is clicked.
Read next
-
How to make a record player spin
-
How to Ship Vinyl Records in Bulk
-
How big are vinyl records
-
How long birth, death and employment records are kept
-
How to Start a Record Player from the Beginning
-
Where to sell vinyl records
-
Top art museums and galleries in Tokyo
-
Terraria player stats and player counts
-
Size of an LP record cover and sleeve
-
Vinyl record shipping boxes at Walmart