Create a Simple Game with Score in Scratch
Create a Simple Game with Score in Scratch
Scratch
Objective:
By the end of this lesson, students will create a simple game in Scratch where the player
collects items and the score increases.
Step-by-Step Explanation:
1. Start your project
Open Scratch and create a new project. You will see a cat sprite and a blank stage.
Go to the Variables section, click "Make a Variable", and name it "Score". This will help
you keep track of points during the game.
Use the "when green flag clicked" block to begin the game. Then add "set Score to 0" to
reset the score every time the game starts.
Go to Events and use the "when key pressed" block (for example, when arrow keys are
pressed). Then add "change x by" or "change y by" blocks from Motion to make the sprite
move left, right, up, or down.
Add a new sprite (like a coin or apple) for your player to collect. Place it somewhere on the
stage.
Use the "if touching [item]" block from the Sensing section. Inside it, place "change Score
by 1" to increase the score when your player touches the item. Then move the item to a
random spot with "go to random position".
When the player gets enough points, use "if Score = 10" with "say You Win!" or
"broadcast" blocks to end the game or show a message.
Main Blocks used in this lesson:
• "when green flag clicked" – starts the game
• "set Score to 0" – resets the score
• "change Score by 1" – adds 1 point
• "when key pressed" – controls the movement
• "change x/y by" – moves the sprite
• "if touching [item]" – checks if the player collects the item
• "go to random position" – moves the item to a random spot
• "say [message]" – shows a message to the player
• "broadcast [message]" – sends a signal to other sprites or scenes
Conclusion:
In this lesson, students learned how to create a simple game where the player moves a sprite
to collect items and earn points. They also learned how to use variables to manage scores.