Space Cat is on a mission to collect as many crystals as possible to fuel his spaceship! Using the Scratch platform, let’s build a fun collecting game to help Space Cat with its mission.

Collecting is a popular mechanic in games and can be easily coded in Scratch with the same basic logic. From weapons to badges, collecting can keep players striving to achieve more in your game. 

In this game, the goal is to collect as many crystals as possible, but if you miss three crystals the game ends. This tutorial shows you how to code this game from start to finish and you can customize it with your own images and messages. 

📌 [Download] Printable Scratch Coding Tutorials Get 2 printable Scratch tutorials, Rocket Landing and Flying Space Cat, to code your own games step by step. Download Now

Code this game and see how many crystals you can collect!

Play Flying Space Cat game.

Scratch tutorial complete

What you need:

Scratch account: Create a free Scratch account 

Starter files: Download the star image we are using in our game. You can also use your own images to customize your application. Download starter file.

No coding experience is necessary for this tutorial. Beginner-friendly for kids ages 8 and up. Give it a try!

Step 1: Create a new Scratch project

Let’s start by creating a new project. 

Scratch tutorial create project

Now, we can code your Flying Space Cat game! 

Hint: You can also remix this project and others to see the code.

Step 2: Add a scrolling background

To give the effect of moving through space, we created a simple scrolling background.

The stars will move while the backdrop stays in place.

Flying space cat scratch tutorial step 2

Hint: Add more images or use a different image than stars.png to customize your scrolling background.

Step 3: Add flying cat and move it

Let’s position our flying cat and add the logic to move it up and down with arrows.

Flying space cat scratch tutorial step 3A

Now, add logic to the arrow keys so our cat moves up and down when we click.

Flying space cat scratch tutorial step 3B

Hint: Change the music by adding more sound options in the “Sounds” tab. Then select them in the “play sound” block.

Step 4: Show random crystals and move them

We want random crystals to appear on the right side of the screen and move toward the left. 

Flying space cat scratch tutorial step 4A
Flying space cat scratch tutorial step 4A
Flying space cat scratch tutorial step 4B

Hint: Select a different sprite or draw your own sprite to customize your collection item.

Step 5: Add up losing crystals

When a crystal flies by us and we don’t catch it, we want to count it. When we reach 3 crystals, the game is over. Let’s add on to the code you started in Step 4.

Flying space cat scratch tutorial step 5A
Flying space cat scratch tutorial step 5B

Hint: You can give different names to your variables, just make sure you are using the right variable in your code.

Step 6: Increase score for gaining crystals

Every time our flying cat touches a crystal, we want to increase our score. In addition to increasing the score, we will also decrease the count of the crystal variable. We do this because even though we are hiding the crystal, it still touches the edge each time.

Flying space cat scratch tutorial step 6A

Inside the forever block, we will add to the game score every time our cat touches a crystal.

Flying space cat scratch tutorial step 6B

Hint: Change the variable “score” to give yourself more points for each crystal. Make sure to also decrease “crystal” by the same amount.

Step 7: Show “Game Over” screen

Your game is almost complete! Let the players know when the game is over by showing a game over screen. This will trigger when you’ve missed three crystals.

Flying space cat scratch tutorial step 7A
Flying space cat scratch tutorial step 7B

Hint: You can change the font, colors, and text for your Game Over message in the “Costumes” tab. 

Your Flying Space Cat game is complete!

Click the green flag and give it a try. If you want to let other people see your project and remix it, click the “Share” button at the top. 

Flying space cat scratch tutorial complete

See the complete Flying Space Cat game.

Download Free Printable Scratch Coding Tutorials PDF

Get the Rocketship Landing game and Flying Space Cat Scratch tutorials in a printable format.

More Scratch Tutorials for Kids

How To Make a Game on Scratch

If you want to build more games in Scratch, check out our Elementary School Coding Program. It’s the most fun and effective way to learn Scratch coding and eventually real-world languages like JavaScript and Python. Classes are live, online with an experienced instructor that is there to support you every step of the way. 

Ready to level up your child’s learning experience? Try the best online coding classes for kids.