Games on Scratch are visually fun and interactive ways of learning coding and game development, especially for children between the ages of 8 to 16. A Jumping Game on Scratch can be of different types depending on the movement of the sprite, objective, and rewards. In this blog, we will discuss how to make a chick jumping game on Scratch.
This is Chapter 2.1 in the
Scratch Game Tutorial
How Do You Make a Jumping Chick Game in Scratch?
You can see a character [Chick] in the above game that will jump on moving obstacles [eggs]. And after each successful jump, you will get a score, and if Chick touches the eggs, the game will be over.
The steps to create this jumping game on Scratch are listed below:
- Creating Chick Character in Scratch for Jumping Game
- Change Backdrop of the Stage in Scratch for Chick Jumping Game
- Add Code To Make The Chick Jump in Scratch
- Creating a Moving Obstacle on Scratch
- Making a Game Stop By Touching an Object in Scratch
- Adding Multiple Obstacles in Chick Jumping Game on Scratch
- Setting Score in Scratch Jumping Game
Before creating jumping chicken game in Scratch, you will have to sign in to the Scratch. The detailed steps on how to join Scratch is explained below:
- 1st Step: Open Scratch. Alternatively, you can click Here to open the editor.
- 2nd Step: Click on “Join Scratch“.
- 3rd Step: Type a username and password and click on the “Next” button.
- 4th Step: After clicking on the “Scratch/Create” button, you should see this empty Scratch project screen with a cat on your stage.
- 5th Step: Double click on “Untitled” and rename your project.
Step 1: Creating Chick Character in Scratch for Jumping Game
Since we are creating a chicken and egg game on Scratch, we need to delete the Cat character and create the Chick character in the Scratch editor. The steps to do this are outlined below:
- Delete the Cat sprite and choose a different sprite for this game as shown in the GIF given below.
- Now click on the Choose a Sprite icon.
- Since we are creating a Chick game, we are choosing the Chick character here. Alternatively, you can pick any character from Scratch’s library of sprites.
- After clicking on the chick, you should see Chick in the stage area as shown in the GIF given below.
Step 2: Change Backdrop of the Stage in Scratch for Chick Jumping Game
Now the next step is to change the backdrop for the chick jumping game. The detailed steps on how to add a backdrop in Sketch are given below:
- Click on “Choose a Backdrop” and choose a backdrop from Scratch’s library of backdrops.
- Click on Forest, and you can pick any backdrop from Scratch’s library of backdrops.
Step 3: Add Code To Make The Chick Jump in Scratch
Now the next step is to add a code which makes the chick to jump on the stage. The steps to get this done are explained below:
- Drag Chick to the bottom left corner.
- Click on “Code” and start writing Chick’s Code. You have to drag the coding block from the block palette and drop it in the code area.
- To make the chick jump, we can change the chick’s Y position by +10 (upward) and -10 (downward).
- Click on the “Motion” block and drag the “change y by” block to change its value to 10 to make Chick jump 10 steps upward.
- Click on the “Control” block palette and drag the “repeat” block to make Chick jump a little higher.
- And drop both blocks into the code area as shown below.
- Click on “repeat” and see Chick jump 100 (10 x 10) steps upward.
- Add the coding blocks shown in the GIF below to move Chick down by the same 100 steps (10×10), so change y by -10.
- Also, drag the “when space key is pressed” block as shown below.
- Click on green flag, so that Chick can jump by pressing the “space” key.
- To enhance the chick, let’s change the costumes to make Chick Beak movable.
- Click on “Costumes” and delete the last costume for Chick.
- Click on “Code.” Let’s write the code when the green flag clicks, then Chick changes their costume every 0.1 seconds.
- Drag “when green flag” and “forever” blocks, and drop.
- In the forever loop, drag “next costume” and “wait” in the stage.
Click on the green flag icon, and you will see Chick’s beak opening and closing. Now to enhance the jump, add a sound effect from the sound coding block as shown below.
Step 4: Creating a Moving Obstacle on Scratch
Now the next step is to create an obstacle on scratch so that Chick has something to jump over. The steps to choosing Obstacles on Scratch are explained below.
- From “Choose a backdrop” and choose any sprite as an obstacle from Scratch’s library of sprites.
- You can pick any sprite from Scratch’s library of sprites.
- Resize your obstacle character a little bit. So it is a bit smaller as compared to your character (Chick). In this example, we are changing the size of the egg from 100 to 80.
- Drag the egg to the right bottom of the stage screen and set the obstacle [egg] position.
- Drag the “go to x, y” position block. Write the egg’s current x and y position.
- We want to start our obstacle from the rightmost point and glide over the leftmost part of the screen.
- Drag the egg to the left bottom of the stage screen and drag the “glide” block.
- Write the x and y position of the egg.
- Set the time to chick glide from right to left, here 2 seconds. You can choose any time.
- Add a forever loop to move the obstacle forever.
- Click on the green flag icon, and you will see eggs are continuously coming (movable).
Step 5: Making a Game Stop By Touching an Object in Scratch
The main idea of the chick jumping game is to make the chick jump without touching the egg. If the chick touches the egg, then the game will be over. So the next step is to write the code that will be executed if the chick touches the egg, and the detailed instructions for doing so are provided below.
- Drag the “when clicked” block and drop it into the code area.
- When clicked, drag the “wait until” block and drop it wherever you want.
- Drag the “touching” block and drop it to wait until it detects if Chick touches.
- Drag the “stop all” block and drop it to “wait until”.
- Click on the green flag icon, and you will see if the egg touches the chick, the game stops.
- To enhance the game stop, let’s add a sound before the game stops.
- Click on “Sound” and choose a sound.
- Search for the Croak sound and click on it. You can choose any sound from Scratch’s library of sounds, and you can also record your own voice.
- Click on “Code”.
- Drag the “play sound until done” block to the “wait until” block.
- Click on the dropdown and select the sound “Croak”.
Step 6: Adding Multiple Obstacles in Chick Jumping Game on Scratch
Now the next step is to make more enemies on Scratch for the Chick. The steps to making enemies (eggs) on Scratch are given below.
- Right-click on the egg to duplicate it.
- You can see another egg added to your stage.
- To make the second egg visible, add some delay before starting gliding.
- Also, hide the second egg for one second when the game starts, otherwise the second egg will be sitting in the middle of the stage screen.
Step 7: Setting Score in Scratch Jumping Game
To make the game more interesting, we can introduce a score system. Each time Chick jumps on an obstacle, it will collect 1 point, which will be added to its score. The detailed steps on how to add a score in the Chick Jumping game are explained below.
- Click on the chick to select and start writing the code.
- Click on the “variable” block and make a variable to keep track of the score.
- Name the variable “Score.” You can name any as shown in the GIF given below.
- Increase the score every time Chick makes a successful jump.
- Drag the “Change by” block and drop it to the “repeat” block.
- Click on the dropdown and select your variable name (score).
- Change the score by one, which means one point.
- Click on the green flag icon, and you will see if the chick jumps over the egg, the score increases by one.
- Also, make the score zero at the start of the game and set Chick’s initial position.
- Drag the “Set to” block to the “goto” block.
- Click on the dropdown and select your variable name (score).
- Set the score value to zero, which means the score will be 0 when the game starts.
Congratulations, you have completed your first jumping game on Scratch!
Scratch is the ideal starting point for learning how to code if making games sounds like fun to them.
While there are many resources and tutorials on the Scratch website, Wiingy offers live training in Scratch and other subjects, as well as customized Scratch coding sessions and more. Request for a Free Demo at Wiingy to learn more.