Coding Ireland STEM Report 2024 Have Your Say
Scratch Game
Advanced
60 mins
165 points
What you need:
  • Computer/laptop

Scratch Flappy Cat

For this project, we are going to create a game where a cat must pass through between pipes.

1 - Creating a Scratch Project

Go to the Scratch website and create a new project. 

2 - Creating a Countdown Timer

Before we begin our game, we have to create a countdown timer first to make sure our players are ready to play the game.

For our countdown timer, we can start at 3 then it goes down by 1 every second. Once it reaches 0, the game begins.

To visually represent our countdown timer, we can go to our sprite library and look for the number 3 sprite. Then we can add four more costumes to this number 3 sprite, for number 2, number 1, zero then Go!



3 - Coding the Timer

Now, it is time to add codes to our timer. We want to change the timer's costume to 3, 2, 1 then Go!!

We can also broadcast a message, Start Game, when we play the game and a message, Show, when the timer runs out.

We can use the codes below to do this.

when green flag clicked broadcast (Start Game v)

when I receive [Start Game v] show switch costume to (3 v) start sound (C Piano v) wait (1) seconds switch costume to (2 v) start sound (C Piano v) wait (1) seconds switch costume to (1 v) start sound (C Piano v) wait (1) seconds switch costume to (Go v) start sound (Gong v) wait (1) seconds broadcast (Show v) hide


4 - Coding the Cat Sprite

For this game, we want to use the Cat sprite

We want to hide the Cat when the game starts. We can do this if we follow the code below.

when green flag clicked hide

Now we want to make our cat show and move to the left side of the screen when the game starts when it receives the Show message.

when I receive [Show v] go to x: (-203) y:(3) show

Next, we want the cat sprite to move up when we press the Space button. We can switch it to a different cat costume and play a sound. And when we are not pressing the space key, the cat will automatically go down.

forever if <key (space v) pressed?> then switch costume to (Cat Flying-b v) start sound (Jump v) change y by (10) end change y by (-5) end

Finally, we want to combine our cats to make our cat go up and down when we are pressing the space key.

when I receive [Show v] go to x: (-203) y:(3) show forever if <key (space v) pressed?> then switch costume to (Cat Flying-b v) start sound (Jump v) change y by (10) end change y by (-5) end


5 - Creating the Pipe Sprite

For this part, we want to create our own pipes

To do this, we can go to our sprite library and add the Apple sprite. Then, we can delete the apple costume and make the pipes costume.

For the costume, we want it to be able to over our screen no matter the height so we need to make sure the pipes are long.


Join our club 😃

To view the remaining 4 steps and access hundreds of other coding projects please login or create an account.

Copyright Notice
This lesson is copyright of Coding Ireland. Unauthorised use, copying or distribution is not allowed.

Scratch is developed by the Lifelong Kindergarten Group at the MIT Media Lab. It is available for free at https://scratch.mit.edu
🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more