Scratch Archives - CodeWizardsHQ The leading online coding academy for kids and teens ages 8-18 Fri, 29 Aug 2025 10:17:48 +0000 en-US hourly 1 https://wordpress.org/?v=6.8.3 https://www.codewizardshq.com/wp-content/uploads/2019/10/cropped-cropped-blueHorizontal-32x32.png Scratch Archives - CodeWizardsHQ 32 32 How to Make a Scrolling Background in Scratch https://www.codewizardshq.com/how-to-make-a-scrolling-background-in-scratch/ Thu, 24 Apr 2025 06:30:47 +0000 https://www.codewizardshq.com/?p=68748 Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

There’s a way to make your Scratch game or project more immersive with just the addition of one or two sprites. A scrolling background is a fun and simple effect where sprites are used to create the illusion of movement and motion. It’s often combined with other effects to enrich a game or project and […]

The post How to Make a Scrolling Background in Scratch appeared first on CodeWizardsHQ.

]]>
Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

There’s a way to make your Scratch game or project more immersive with just the addition of one or two sprites. A scrolling background is a fun and simple effect where sprites are used to create the illusion of movement and motion. It’s often combined with other effects to enrich a game or project and make it more visually appealing.

📌 [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

In this tutorial, I’ll show you how to make a scrolling background in Scratch. Just like in the real world, backgrounds and locations change as we move. We’ll try to recreate this with our Walk In The Park project. It’s a great effect to add to any project, so give it a try!

A Walk in The Park Complete gif

View and remix the Walk In The Park project now.

What you need:

No coding experience is necessary for this scrolling background tutorial. Beginner-friendly for kids ages 8 and up.

How to Make a Scrolling Background in Scratch

Our project is comprised of three different parts: the walking cat, the floating cloud, and the rolling hills.

Step 1: Create a New Scratch Project

We always start in Scratch by creating a new project. 

create a scratch project
  • A new project will open, rename the sprite to “cat”
  • Rename your project to “A Walk In the Park”
rename your scratch project and sprite

You’re ready to code!

Scrolling background step 1 gif

Hint: Name your project anything you want and click on the orange “Share” button to make it available for others to remix.

Step 2: Draw the Background

The cat is walking in a basic setting with a blue sky and dirt path. We’ll create this scene as a backdrop.

  • Hover over the “Choose a Backdrop” icon and select “Paint”
paint a backdrop
  • Use the rectangle tool to draw a blue rectangle for the blue sky
  • Use the rectangle tool to draw a brown rectangle for the dirt path
use the rectangle to paint a background

In the preview screen, you will see your cat sprite and the background you drew. You can reposition your cat sprite around to fit your new scene. This backdrop is not part of the moving background.

Once you’re finished designing your backdrop, we can animate the cat to take a stroll! 

Scrolling background step 2

Hint: You can draw more details in the background to fit your game or project.

Step 3: Animate the Cat Walking

The cat sprite stays in place on the path, but appears to be walking. We animate the cat by changing its costume from having its foot down to up, then repeating that process.

  • Click on the “cat” sprite to add code to it
  • Start with a “when green flag clicked” block from the Events category
  • Add a “forever” loop to continuously run the code blocks inside
  • Inside the loop, add a “wait 0.5 seconds” from the Control category
  • Underneath the wait block, add “next costume” to change costumes
animate cat walking

This means that every 0.5 seconds, the cat’s costume will switch.

Press the green flag to test your code. It should look like your sprite is walking!

If it works, let’s move on to add a scrolling background. 

Scrolling background step 3 gif

Hint: See the different costumes in the “costumes” tab and add costumes to create your own walking effect.

Step 4: Draw the Scrolling Background Sprites

We need to draw two sprites to represent the hills that scroll in the background. These sprites will move across the screen to create the scrolling effect.

  • Hover over the “Choose a Sprite” icon and select “Paint”
paint a scratch sprite
  • Use the square tool to draw a green rectangle from one edge of the project screen to the other
  • Add a few points on the top of the rectangle using the “Reshape” tool
  • Drag the points up and down to create multiple hills. The only points you should not change are the corners of the rectangle, so that the two points line up in the animation.
draw the hills

In order for our sprite to go off the screen as it moves, we will add a transparent box behind it that increases the width of our sprite.

  • Use the square tool to draw a transparent rectangle from one edge of the artboard to the other.
  • Then, rename the sprite “hills1”
draw transparent box

Now, create the second sprite.

  • Right-click on the “hills1” sprite and select duplicate
duplicate hills1 sprite
  • Rename the new sprite “hills2”
rename hills2 sprite

In your preview screen, you can see both sprites. These two sprites are all you need to make a seamless scrolling background! 

Scrolling background step 4 gif

Hint: You can change the color of the “hills2” sprite so you can see how the effect is working in your preview screen. Later, change it back to match “hills1”.

Step 5: Animate Sprite 1 in the Hills Background

The background position of the hills sprites will move from right to left and then start that process again continuously like this:

how scrolling works in scratch

The “hills1” sprite starts in the center of the project. When we start the program, place it there.

  • On the “hills1” sprite, add a “when green flag clicked” block
  • In the preview screen, set the “hills1” sprite in the center. Use those x and y coordinates in a “go to” block. My sprite is positioned at x = 1 and y = 25 so I will use those coordinates.
go to block

Next, we want the sprite to scroll all the way to the left until it goes off the screen. 

  • In the preview screen, set the “hills1” sprite just off the left side of the screen. Use those x and y coordinates in a “glide 10 seconds to” block. My sprite is positioned at x = -480 and y = 25.
Go to and glide to position background
  • You might have noticed your “hills1” sprite covers the “cat” sprite. Under “when green flag clicked” add a “go to back layer” from the Looks category.
  • Wrap a “forever” loop around these blocks to repeat the actions.
loop the background movement

Click the green flag to see your “hills1” sprite moving to the left. Keep it up, only a few steps left! 

Scrolling background step 5 gif

Hint: Experiment with the timing and position of your sprite to fit your animation.

Step 6: Animate Sprite 2 in the Hills Background

The code for the second hills sprite will have the same format as the first sprite. However, the sprite will start at the right side of the screen and move to the center.

When we start the program, place “hills2” off to right side of the screen.

  • On the “hills2” sprite, add a “when green flag clicked” block
  • Next add a “forever” loop underneath it, since we want to repeat these actions
  • Inside the loop add a “go to back layer” block
  • In the preview screen, set the “hills2” sprite just off of the right side of the screen.
  • Use those x and y coordinates in a “go to” block. My sprite is positioned at x = 480 and y = 25.
go to x y position

Now, we want the sprite to move to the left until it gets to the center where the “hills1” sprite started. 

  • Add “glide 10 seconds” block and use the same coordinates that “hills1” sprite started with. 
glide to position

Click the green flag to see your hills moving to the left. Is everything working properly?

Scrolling background step 6 gif

Hint: If you are seeing a gap between your two sprites, increase or decrease the x position on the hills sprites.

Your scrolling background is complete! View and remix A Walk In The Park project.

A Walk in The Park Complete gif

This is just one way to create a scrolling background effect. You can test different designs, speeds, and timings to create a unique experience for your project or game. In the bonus steps, I will show you how to animate a cloud in the background scroll and add music to your project.

If you want to learn from the experts, join our top-rated Scratch classes for kids.

Bonus 1: Add and Animate a Scrolling Cloud Sprite

Let’s create a scrolling background animation with only one sprite.

  • Click on the “Choose a Sprite” icon
choose a spirte button
  • Search for the “cloud” sprite and click to add it
select the cloud sprite
  • Since we want this sprite to go offscreen, go to Costumes tab and use the square tool to add a transparent rectangle in the background. This will allow the sprite to go off screen.
add a transparent background

 Now, let’s add the code that moves the cloud object.

  • Click on the “Code” tab
  • Start with a “when green flag clicked” block
  • Add a “forever” block from the Control category
  • Add  a “go to” block inside the loop. Position your cloud to the right off-screen and use those coordinates, mine are x = 325 and y = 100
  • Then, glide the cloud to the left side of a screen with “glide 7 seconds to”. Position your cloud to the left off-screen and use those coordinates, mine are x = -325 and y = 100
forever go to and glide

Press the green flag to see your cloud floating in the sky. 

Scrolling background bonus 1 gif

Hint: Change the number of seconds in the glide block to make your cloud move faster or slower.

Bonus 2: Add Music to Your Scrolling Background Project

First, let’s set the background music we want to add.

  • Click on the cat sprite and go to the “Sounds” tab
  • Click on the “Choose a Sound” icon at the bottom
go to sounds tab
  • Select a sound from the “Loops” category. I’m using Dance Around.

Now, let’s add the code that plays the music in the background.

  • Go to the “Code” tab
  • Add another “When green flag clicked” block
  • Underneath that, use a “forever” block to continuously play the music
  • Inside the loop, use a “play sound until done” and select the sound you chose.
play sound until done

Hit the green flag to listen to the song. What a nice atmosphere you’ve created by adding background music to your scene! 

Scrolling background bonus 2 gif

Hint: You can upload a music file or even record a song to play in the “Sounds” tab. 

Learn More Scratch Effects with Tutorials

There are so many possibilities in Scratch! You can learn to code different effects, like the scrolling background, through tutorials or join a Scratch class to learn from the experts. 

Try one of these fun beginner tutorials next.

Download Free Printable Scratch Coding Tutorials PDF

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

Try a Scratch Coding Class for Kids

Now you know how to make a scrolling background in Scratch! It’s simple and you can include it in any game or project you code to make it better.

Kids can also learn Scratch from the experts in our elementary school coding program. It’s designed to teach kids, ages 8-11, how to think like programmers while building fun, interactive projects. Students learn fundamental programming concepts in Scratch and then advance to text-based languages like JavaScript and Python. It’s the best way for kids to learn Scratch.

Explore our programs and join our top-rated Scratch classes for kids.

The post Scratch Coding for Kids: Halloween Candy Collector Game appeared first on CodeWizardsHQ.

]]>
How to Make a Clicker Game on Scratch https://www.codewizardshq.com/how-to-make-a-clicker-game-on-scratch/ Tue, 15 Apr 2025 05:40:13 +0000 https://www.codewizardshq.com/?p=68452 Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

Simple and addictive, the classic clicker game is easy and fun for everyone in the family Our party-themed Cookie Clicker shows kids how to make a clicker game on Scratch that displays a score counter. In this game, kids bake cookies with every click and watch their cookie count increase. The goal is to bake […]

The post How to Make a Clicker Game on Scratch appeared first on CodeWizardsHQ.

]]>
Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

Simple and addictive, the classic clicker game is easy and fun for everyone in the family Our party-themed Cookie Clicker shows kids how to make a clicker game on Scratch that displays a score counter. In this game, kids bake cookies with every click and watch their cookie count increase. The goal is to bake 999 cookies. Try this easy Scratch tutorial for kids to customize your own clicker game.

📌 [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

You can also learn to code from the experts in our top-rated Scratch coding classes

Cookie clicker game complete

Play and remix the Cookie Clicker game now.

Table of Contents

  • Step 2: Add a backdrop
  • Step 1: Create a new Scratch project
  • Step 3: Draw the cookie sprite
  • Step 4: Add game logic to increase the cookie count
  • Step 5: Animate the cookie click
  • Step 6: Create the ones counter
  • Step 7: Create the tens counter
  • Step 8: Create the hundreds counter
  • Step 9: Stop the counter at 999 cookies

What you need:

No coding experience is necessary for this Scratch 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. 

Create a new Scratch project
  • A new project will open, rename your project to Cookie Clicker
  • Hover over the cat sprite and click the trash can to delete it

A new project will open up and you will see the Scratch interface.

Rename Scratch projectRem

Hint: You can also remix shared projects by clicking the green Remix button on the project page.

Step 2: Add a backdrop to your game

Now we can code our clicker game! In the new project, we can add a background to our game.

  • Click the “Choose a Backdrop” icon 
Choose a backdrop button
  • Search for the “Party” backdrop and click to add it
Find the party backdrop

The backdrop will appear in the preview screen and sets the scene for your game.

Clicker step 2 gif

Hint: Choose any backdrop from the library or upload your own to fit your game design.

Every clicker game needs a clickable object. For this game, draw a cookie sprite using the Paint option.

  • Hover over the “Choose a Sprite” icon and select “Paint”
Select paint icon
  • Draw the base of the cookie by clicking the circle tool. Click on the artboard and drag the mouse to create a circle. 
  • Change the color of the circle using the color selector
  • Draw smaller circles with the circle tool to decorate the cookie
Draw a cookie in costumes
  • Position the cookie on the background in the preview area
  • Click on the Code tab and rename the sprite to “cookie”

The cookie sprite should now be visible. However, nothing happens when we click the cookie. 

We’ll add that next, keep going! 

Draw the cookie sprite gif

Hint: Draw or select any sprite you want to fit your game design.

Every time we click on the cookie, we bake one cookie for the party. So, the number of cookies increases by one with every click. We’ll use a variable to represent the increasing number of cookies.

  • Go to the variables category and right-click the “my variable” block
  • Click “Rename Variable”
Rename variable
  • Rename the variable “cookies” and click ok
rename variable cookies
  • Check off the “cookies” variable 
Check off cookies variable
Add game logic to cookies gif

The variable counter will now appear in the preview screen. We should start the number of cookies at 0 when the game starts.

  • On the cookie sprite, add the “When Green Flag Clicked” block from the Events category
  • Add a “Set cookies to 0” block from the Variables category 
  • Go to the Events category and select a “When this sprite clicked” block
  • Underneath that, add a “Change cookies by 1” block from the Variables category
Set cookies variable

Click the green flag to test your game. The variable “cookies” should start at 0 and increase every time you click the cookie sprite. 

Good job so far, let’s keep going!

Add game logic to cookies gif

Hint: You can add other sprites that increase the number of cookies by different amounts.

The cookie is pretty boring, let’s animate the cookie when it’s clicked by making the size of the cookie change.

  • On the cookie sprite, add a “When this sprite clicked” block from the Events category
  • Go to the looks category and add a “change size by 5” block. Increase the size slightly when we click. 
  • Add a “wait” block from the Control category and update the time to 0.05 seconds
  • Return this sprite to its original size. Select “set size to 100%” from the Looks category.
Cookie animation

Try it out by clicking the Cookie sprite. Do you see the animation working? Great job!

Animate the cookie click gif

Hint: Change the animation by increasing the size or wait time.

Step 6: Create the ones counter sprite

The counter is made up of three different sprites. Let’s start with the sprite that represents the ones.

  • Click on the “Choose a Sprite” icon
Choose a sprite
  • Search for the “Glow-0” sprite and click to add it
Select glow 0 sprite
  • Rename this sprite “ones”
Rename the sprite
  • Position and resize it in the preview to fit your theme
position and resize sprite

Now,  we’ll add costumes for numbers 0 through 9 to the same sprite.

  • Click on the “Costumes” tab
  • Click the “Choose a Costume” button
  • Add a costume to represent numbers 1 through 9, we are using Glow-1 through Glow-9
Add costumes for 0 to 9
Create the ones counter sprite gif

Now we can add code to connect the “ones” sprite to the cookie clicks. Start with the cookie.

  • On the cookie sprite, add a “broadcast” block
  • Click “New message” in the dropdown and name it “count”
broadcast count

 The sprite changes costumes each time the cookie is clicked.

  • On the ones sprite, add a “when green flag clicked” block
  • Add “switch costume to Glow-0” to start with the 0 costume
  • Use the “when I receive count” block to get the message
  • Then, add “next costume”
switch costumes

You should see the first part of your counter on your screen. Click the cookie 9 times and watch it change! 

Create the ones counter sprite gif

But, it doesn’t go past 9, so we’ll add the rest of our counter in the next step.

Hint: You can draw or choose your own number sprite, just make sure to include costumes for numbers 0 to 9. 

Step 7: Create the tens counter sprite

We have a sprite to represent the ones, now let’s add another sprite to represent the tens.

  • Right-click on the “ones” sprite and click duplicate
Right click ones
  • Position the sprite in the preview and rename this sprite “tens”
Rename the sprite tens
  • Add an if-then loop from the Control category around the “Next costume” block.
  • Inside the loop, add the equals block from “operators”. On the left, add a “mod” block and, on the right, use 0
  • Inside the mod block, add the “cookies” variable on the left and use 10 on the right. The complete formula (cookies mod 10 = 0) means that if the number of cookies is divided by 10, the remainder is 0.
Add if then loop with condition
Create the tens counter sprite gif

Hint: Double-check that your counter matches the tens number in the “cookies” variable. 

Step 8: Create the hundreds counter sprite

After that, create one more sprite to represent the hundreds.

  • Right-click on the “tens” sprite and click duplicate
Right click tens sprite
  • Position the sprite in the preview and rename this sprite “hundreds”
Rename hundreds sprite
  • Inside the mod block, change the 10 to 100. The complete formula (cookies mod 100 = 0) means that if the number of cookies is divided by 100, the remainder is 0.
Change mod block

Click the green flag to reset your game, then click on the cookie to watch the numbers increase! 

Create the hundreds counter sprite gif

Hint: Double-check that your counter matches the hundreds in the “cookies” variable. Then uncheck the “cookies” variable to hide it from the screen.

Step 9: Stop the counter at 999 cookies

The goal is to bake 999 cookies, so when we reach that number the counter should stop. 

  • Select the cookie sprite
  • Add an if-then loop, before “change cookies by 1” 
  • Add an equals condition, use 999 on the left and cookies on the right
  • Inside the loop, add “stop all” from the control category
Add if then block

Click the sprite to watch the counter in action.

Stop the counter at 999 cookies gif

Hint: Use additional if-then statements to add effects and bonuses at different cookie counts.

Cookie clicker game complete gif

With that final step, your Cookie Clicker game is complete! Play Cookie Clicker game.

If you want to let other people see your project and remix it, click the “Share” button at the top.

Add upgrades to your clicker game!

Scratch has a number of sound effects and songs you can add to your project. Let’s play a sound each time we click on the cookie. 

  • Select  the cookie sprite and go to the “Sounds” tab
  • Click the “Choose a Sound” button on the bottom left
Click the sound tab
  • Find the sound “Suction Cup” and click to add it
Choose the suction cup sound

The sound has been created, now add the code the play the sound.

  • Click on the Code tab
  • Add the “start sound” block and choose “Suction Cup” under “when this sprite clicked”
start sound block

Press the green flag and click your cookie to hear the sound! 

Hint: Select any sound or even record your own to match your game’s theme.

Bonus #2 – Add a balloon animation at 999 cookies

Celebrate when the player successfully bakes 999 cookies! In this game, we show a floating balloon animation.

Every time we click, we’ll check to see if we’ve made enough cookies. Once we reach 999, we will send a message that the cookies are done and the party is on.

  • Select the cookie sprite
  • Inside the “if 999 = cookies” loop, add a broadcast block 
  • Click “New message” in the dropdown and call it “party”
  • Underneath that add a “wait” block and change it to 2 seconds. This is how long our animation will play.
broadcast block

Next, add the balloon sprite that receives the message and performs an action.

  • Click the “choose a sprite” icon, find the “Balloon1” sprite, and click to add it
choose balloon 1 sprite
  • Rename it “balloons” and resize it in the “Size” field to 300
Rename and resize balloons
  • Add a “when green flag clicked” block
  • Then, use a “hide” block from the Looks category
When green flag hide

Finally, add the code that makes the balloon float.

  • Add the “When I receive” block and select “party”
  • Add “start sound” and select “Clapping”
  • Position the sprite with  “go to x: 0 and y: -275”
  • Underneath, add the “show” block to make the balloon visible
  • Move it to the top using “glide 2 seconds to x: 0 and y: 275”
When i receive party

Your animation should work now!

To test it, update “if 999 = cookies” on the cookie sprite to “if 2 = cookies”. Then click the cookie to view the animation play. Change it back when you’re sure it works.

Hint: You can add any effect when you reach 999 cookies, just add it inside the “if 999 = cookies” loop.

Discover More Clicker Games on Scratch

You can find a lot of clicker games in Scratch to use for ideas and inspiration. You can also remix them to see the code inside. This is a great way to expand your knowledge and the kinds of games you can build in Scratch.

These are some of the top clicker games in Scratch.

Pokemon Clicker (51834 hearts)

Click your way to getting every pokemon in this popular Scratch clicker game. Keep clicking to get points that you can use to upgrade your pokeballs, and collect popular pokemon to become the very best.

Planet Clicker (31326 Hearts)

Click on the planet to generate energy. This game features a store to buy upgrades and add energy. Through your username, it also keeps tracks of your stats like clicks and time played that you can access in the menu.

Roblox Clicker #Games #All (25716 Hearts)

This Roblox Clicker in Scratch lets you generate dummy Robux with every click. You can use in-game codes for more Robux and even customize your clicker with different skins. 

Cookie Clicker (24525 Hearts)

A simple cookie clicker with upgrade options all on one page. The game uses cloud variables for an auto-save functionality that lets you save your game and come back to keep clicking.

Money Clicker (23267 hearts)

Click your way to a fortune in the Scratch Money Clicker and get help by hiring employees, building companies and factories, and digging mines. This game has a clean design and scrolling feature for the upgrades.

Minecraft Clicker (17770 hearts)

Minecraft-themed clicker game where you click a building block to earn points. You can also buy upgrades to earn points quicker, like hiring the miner for help.

See more of the best Scratch games.

Get More Fun Scratch Tutorials

Keep coding with more fun Scratch tutorial for kids.

Download Free Printable Scratch Coding Tutorials PDF

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

Try a Scratch Coding Class for Kids

Once kids complete the Cookie Clicker game they can customize it endlessly. Completing this tutorial is just one way that kids can learn about coding in Scratch. 

If this tutorial inspired your child to learn more coding, try a Scratch coding class at CodeWizardshQ. Our elementary school coding program is designed to teach kids, ages 8-11, how to think like programmers while building fun, interactive projects. It starts by teaching fundamental coding concepts in Scratch and then advances to text-based languages like JavaScript and Python. Classes are live, online so they’re fun and engaging for kids while being convenient for parents. 

Learn more and join our top-rated Scratch classes for kids.

The post Scratch Coding for Kids: Halloween Candy Collector Game appeared first on CodeWizardsHQ.

]]>
Fun Ways to Use the Pen Tool in Scratch https://www.codewizardshq.com/fun-ways-to-use-the-pen-tool-in-scratch/ Mon, 16 Dec 2024 07:27:31 +0000 https://www.codewizardshq.com/?p=67099 Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

The Scratch pen tool is a fun extension to any Scratch project and teaches kids about conditionals and events. Scratch coding is a great way to introduce fundamental coding concepts to kids and teens. Once they have the basics down, Scratch is powerful enough to make robust apps and games. The pen tool is especially […]

The post Fun Ways to Use the Pen Tool in Scratch appeared first on CodeWizardsHQ.

]]>
Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

The Scratch pen tool is a fun extension to any Scratch project and teaches kids about conditionals and events. Scratch coding is a great way to introduce fundamental coding concepts to kids and teens. Once they have the basics down, Scratch is powerful enough to make robust apps and games. The pen tool is especially great for creative and drawing projects.

Kids who want to dive in and develop their Scratch skills can learn live from expert instructors. Take a look at our top-rated Scratch classes for kids.

In this article, I’ll show you how to setup the pen tool and creative ways to use it in your project.

What does the pen tool do? 

The Pen tool acts like a digital pen where users can draw, create patterns, and make interactive graphics directly on the Scratch canvas. A mouse or a sprite acts as a pen and draws a line from its center. The Pen can be used to draw simple shapes and lines all the way up to using loops and conditionals to draw complex images and patterns. 

It’s a fun way for kids to enhance their projects. My students especially enjoy the pen projects because they love being able to draw freehand. The Pen tool is often used for creative projects, such as designing art, animating visual effects, or building interactive activities like drawing apps.

Set Up the Pen Tool in Scratch

The Pen blocks are not one of the standard blocks in Scratch so it needs to be added as an extension. To do that, follow these simple steps:

  1. Visit scratch.mit.edu
  2. Login to your Scratch account
  3. Click on the Create button
Create a new Scratch project
  1. Under the blocks, click Add an Extension
Add a scratch Extension
  1. Select Pen
pen tool

Once you’ve applied the extension, you should see a new set of blocks in the block palette called Pen. These blocks will control the Pen application in your project.

see the new pen blocks

Pen Blocks in Scratch

There are a just a handful of Pen blocks, but they can accomplish a lot! 

  • erase all
  • stamp
  • pen up
  • pen down
  • set pen color to [color]
  • change pen color by [number]
  • set pen color to [number]
  • change pen size by [size]
erase all block

erase all: Clears all drawings made with the pen tool on the stage. It erases everything drawn without affecting the backdrop or sprites themselves

stamp block

stamp: Copies the current look of the sprite onto the stage as a static image. It’s often used with “Pen Down” and “Pen Up” to create patterns, tiled images, or animated scenes.

pen up block

pen up: Lifts the pen off the stage, stopping any drawing until “pen down” is used again. This is helpful for moving a sprite without drawing a line.

pen down block

pen down: This command starts drawing whenever the sprite moves. It’s used to make continuous lines as the sprite moves across the stage.

set pen color black

set pen color to [color]: Allows users to change the color of the pen. This is often used to add colorful designs and drawings.

change pen color block

change pen color by [number]: Adjusts the current color of the pen by a specific value, which can create color gradients or rainbow effects as the sprite draws.

set pen color to block

set pen color to [number]: Adjusts the current color of the pen by a specific value, which can create color gradients or rainbow effects as the sprite draws.

change pen size block

change pen size by [size]: Sets the thickness of the pen line. Larger values make thicker lines, which can be useful for emphasizing parts of a drawing.

set pen size block

set pen size to [size] Sets the thickness of the pen line. Larger values make thicker lines, which can be useful for emphasizing parts of a drawing.

Fun Ways to Use the Pen in Scratch

Using the pen tool is kind of like drawing on paper, with a twist. By combining the pen blocks with loops, variables, and other blocks, kids can create all kinds of art and animations. These are just some of the cool things you can do with the pen tool. 

  • Draw freehand
  • Draw shapes with math
  • Customize pen colors/width
  • Use variables
  • Animation
  • 3D
  • Using loops with the pen tool

Draw Freehand

You can use any sprite as a pen and draw with it. If you want it to look like you’re drawing with your mouse, simply hide the sprite. This code allows you to draw when your mouse is clicked. You can also set the pen color and size. 

draw freehand block

Example project: Paint App

Our student, Kiera, created this simple painting app where the user can make multiple brush selections.

paint app project in Scratch

View project

Draw Shapes (with Math)

There are several ways to draw shapes using the pen tool. You can simply use a series of blocks to guide your sprite. Using math, you can build shapes quickly and easily.

To create any shape you need to know:

  • Number of sides: Decide how many sides your shape will have (e.g., 3 for a triangle, 4 for a square).
  • Angle to turn: Calculate the angle for each turn using the formula: Angle=360∘/Number of sides

For example, this code will draw a triangle with 3 sides that are each 100 pixels. The number of sides is 3 and the angle to turn is 120. Set your sprite to start at the beginning of the shape.

Drawing shapes block

Example project: Pen Shape Drawer

In this app, users can choose the number of shapes, sides, and the size of the lines to generate a drawing. 

Pen shape project

View project

Customize pen colors and size

Add your own style and creativity to your project by customizing the pen color and sizes. You can use the “set pen color to” block with an RGB color and “set pen size to” block with a number of pixels. You can even use variables and loops to change these features as you’re drawing with the “change pen color to” and “change pen size to” blocks.

This code draws a 5px line in turquoise when the pen is down:

customize pen size and color

Example project: Pen Paint

The Pen Paint app uses buttons to controls the size and color of the pen to create beautiful drawings.

View project

Use variables

Using a variable makes your application more flexible and robust. Allow users to select the color and size for the pen dynamically. You can also change the color and size with code as you draw. By adding variables the possibilities are endless.

Set the pen’s thickness based on a number variable with this code:

Set pen variable
pen block with variables

Example project: Paint App

Our student, Kiera, created this painting app that takes user input and has buttons to create shapes with a click.

paint app project

View project

Animation

The pen tool can draw shapes and change the size and color of the pen dynamically. This makes it possible to create unique effects in your program. 

This code creates an ongoing circle animation using the pen tool:

animation code blocks

Example project: Pen Animation #1 Tutorial

Watch this colorful and entrancing animation that uses just a few pen blocks. 

pen animation project

View project

Using loops with the pen tool

You can use loops in combination with the pen tool to create cool drawings and effects. Create complex shapes using the loop blocks. This code repeats a hexagon drawing to create a unique new shape.

pen tool with loop

Example project: Fruit Ninja

Fruit Ninja is a student favorite where we cut the fruit using a line drawn with the pen tool. 

fruit ninja project

View project

3D Drawings

The pen tool can also be used to make 3D drawings. Even though Scratch doesn’t provide tools specifically for creating 3D art, a combination of existing blocks and the pen tool can help you create the illusion of 3D graphics.

One way is to create multiple layers with stamps, to create a 3d effect. We applied this to create a 3d block.

3d drawings blocks in Scratch

Example project: 3D Maze Rendering

Go beyond the flat 2D drawings and render 3D graphics with the pen tool.

3d maze rendering project

See project

Project Ideas Using the Pen Tool 

Do you need some inspiration for your first pen project? You’d be surprised at everything the pen tool can do. Check out some of the most loved Scratch pen projects:

Download Free Printable Scratch Coding Tutorials PDF

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

Learn to Code Games in Scratch 

The pen tool is just one type of extension in Scratch. Besides the basic blocks like Controls, Motion, and Variables, there are extensions that use artificial intelligence, text-to-speech, and video sensing. Kids can learn to code in Scratch with these extensions and more in our Elementary School Core Track.

In our elementary school coding program, kids, ages 8-10, use Scratch to learn fundamental coding concepts. With a solid foundation in programming concepts, they can then advance to text-based languages like JavaScript and Python.

If you want support teaching your child to code, enroll in our top-rated Scratch coding classes.

The post Fun Ways to Use the Pen Tool in Scratch appeared first on CodeWizardsHQ.

]]>
How to Make a Maze in Scratch in 7 steps https://www.codewizardshq.com/how-to-make-a-maze-in-scratch-in-7-steps/ Mon, 18 Nov 2024 02:35:31 +0000 https://www.codewizardshq.com/?p=66538 Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

A maze is a simple puzzle where you try to find your way from the beginning to the end. Completing a maze tests your memory, problem-solving skills, and patience. Coding does the same! Both require having to think logically and in order.   In this tutorial, I’ll show you an easy and fun way to code […]

The post How to Make a Maze in Scratch in 7 steps appeared first on CodeWizardsHQ.

]]>
Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

A maze is a simple puzzle where you try to find your way from the beginning to the end. Completing a maze tests your memory, problem-solving skills, and patience. Coding does the same! Both require having to think logically and in order.  

In this tutorial, I’ll show you an easy and fun way to code a maze in Scratch where you control the player with your arrow keys. As a bonus, I’ll also teach you how to animate your character and add a timer. 

You can learn to build a maze and other fun Scratch games with a live instructor in our top-rated coding classes. My elementary school students really enjoy how engaging and easy Scratch coding is. They just have to drag and drop to create cool games and programs. By coding a maze, we’ll learn about loops, collision detection, and events. 

Complete this tutorial to code a maze Scratch!

Completed maze game

Play and remix the complete maze game now. 

In this game, the baby penguin, Pesto, has lost his hat. Mom is going to be mad! Help him find his winter hat to win.

We can break down this game into 3 main components: 

1. The maze: A drawing of a maze obstacle players have to avoid and make their way through.

  • Draw the maze

2. The player: the player, the penguin, moves around the maze and returns to the beginning when they touch the edge.

  • Add and position the player
  • Move the player around the maze
  • Detect player collision with the maze

3. The goal: the goal, the winter hat, is placed at the end of the maze and the player wins when they reach the goal.

  • Add and position the goal
  • Detect player collision with the goal

What you need:

Scratch account: Create a free Scratch account

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

Steps to Make a Maze Game in Scratch

Let’s turn each of the parts we discussed previously into steps:

  1. Create a new Scratch project
  2. Add a backdrop
  3. Draw the maze
  4. Add and position the player 
  5. Move the player around the maze
  6. Detect player collision with the maze
  7. Add and position the goal
  8. Detect player collision with the goal

Step 1: Create a New Scratch project

First, we need to set up a new project in Scratch where we will edit our code. 

  • Visit scratch.mit.edu
  • Login to your Scratch account
  • Click on the Create button
Create a new Scratch project
  • A new project will open, rename your project to Penguin Maze Game
  • Hover over the cat sprite and click the trash can to delete it
Name Scratch project Penguin maze game

Now we have a fresh new project to code our maze game!

Hint: You can also remix the Penguin Maze project to see the completed code.

Step 2: Add a Backdrop

Set the stage for your game by adding a background image.

  • Click the Choose a Backdrop button
Choose a backdrop button
  • Select the Arctic backdrop
select the arctic backdrop in scratch

You should now see the backdrop in your preview area. 

see the backdrop in Scratch preview

Hint: Get creative and select a backdrop that matches your theme. You can also select Surprise to let Scratch choose for you. 

Step 3: Draw the maze

A maze is simple to draw with just horizontal and vertical lines. We’ll draw our own maze, make sure you leave enough room for your player to get through. 

  • Hover over the choose a sprite button, select Paint
select paint button
  • Click on the line icon
  • Select an outline color and change the size of your lines to 20
  • Click and drag lines to represent the maze. Adjust it to fit the game preview.
outline maze sprite
  • Click the Code tab and rename the sprite to Maze.
rename the maze sprite

Do you see your maze in the preview screen like this? Great!

see the maze in the preview

Hint: You can make the maze as easy or hard as you want. Add more lines and dead ends to make the maze harder. 

Step 4: Add and position the player

We want to add our player, the penguin. The penguin is going to start at the top left every time the game starts. Before we move the penguin, position it at the top with our code.

  • Click the Choose a Sprite button in the right corner
choose a sprite button
  • Select the Penguin 2 sprite from the library
select the penguin sprite
  • Change the size to fit your maze, my penguin is 20.
change the penguin sprite size

Next, add this code to the penguin so that it goes to the starting position every time the game starts. 

  • Add a When green flag clicked block from events category.
  • Add Go to x y position block from motion category. Use the x and y value of your sprite at the starting position.
go to x y
see the penguin move

Now, try moving your player away from the starting position. When you click the green flag, it should return there. If your test works, you’re ready for the next step. 

Hint: You can get creative and draw your own sprite, just hover over the add a sprite button and go up to Paint.

Step 5: Move the player around the maze

The penguin is on the screen, but he can’t move. The penguin needs to move up, down, right, and left when we press the arrow keys. We need to control him with the arrow keys.

Let’s add the logic to the arrow keys. To move the sprite right and left, add this code: 

  • In the Events category, add When right arrow key pressed block
  • Add a Change x by block from the motion category and change the value to 10
  • Right click on When key pressed block and Duplicate the entire code block
  • Then change the dropdown to When left arrow key pressed and change x by to -10
when right or left arrow key pressed blocks

To move the sprite up and down, add this code: 

  • In the Events category, add When right arrow key pressed block
  • Add a Change y by block from the motion category and change the value to 10
  • Right click on When key pressed block and Duplicate the entire code block
  • Then change the dropdown to When left arrow key pressed and change x by to -10
when up or down arrow key pressed blocks
complete code for penguin movement

Your penguin can move now! Try pressing the arrow keys and make sure the penguin is moving in the right direction.

Hint: To move the player faster or slower, change the x and y values. 

Step 6: Detect player collision with the maze

We need to code what happens when the player touches the maze. The penguin should say ‘Oh no!’ and go back to the starting position.

  • On the player sprite, add a Forever block.
  • Inside the Forever block, add an If then block
  • From the sensing category, add the Touching block inside the if then block. Change the dropdown to the Maze sprite.
  • From the looks category, add a say block and update the message to “Oh no!”
  • Finally, add a go to block and use the same x y position as the starting position 
detect a collision with if then block
detect a collision final code

Now, you can try touching the maze with your player sprite. Does it return to the starting position?

It’s working, let’s keep going! 

Hint: You can customize the message your sprites says or change what happens after the sprites touch. 

Step 7: Add and position the goal

Our player is in place and can move around the maze. Now, let’s place the goal at the end of the maze. 

  • Click the Choose a Sprite button in the right corner
  • Select a sprite from the library. I’m using one from the Scratch library called Winter Hat.
choose the winter hat sprite
  • Change the size to fit your maze. Mine is size 40.
change your maze to size 40
  • Add a “when green flag clicked” block
  • In the preview, position the hat at the end of the maze. Then add a Go to x y position block using those coordinates. Mine is positioned at x = 195 and y = -135.
position the hat
position the hat code

Once you’re done, click the green flag to test your game. Your hat should go to the end of the maze when the green flag is clicked.

Hint: You can customize the goal sprite to fit your theme by drawing or uploading a sprite.

Step 8: Detect player collision with the goal

To win the game, the player needs to reach the goal. When the player teaches the goal, they say “I found it!” and the game ends.

  • On the player sprite, inside the forever block, add an if then loop
  • From the sensing category, add the Touching block inside the if then loop. Change the dropdown to “Winter Hat”
  • Add say block and update the message to “I found it!”
  • From the control category, add a stop all block to end the game
detect a collision with the goal
penguin code for collision detection

Hint: You don’t have the complete the maze to test your game. Just drag your character sprite to the end in your game preview.

Your maze game is complete! Play the maze game.

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

completed maze game gif

You can “see inside” the completed maze game to view the full Scratch code. 

Challenge yourself by adding the bonus features to your maze. 

Bonus: Animate the player 

We can animate the penguin by making it look left and right when it moves. To do this, we’ll create a costume for each look.

1. Create the costumes

  • Click on the costumes tab, you will see different poses for the penguin on the left
costumes tab in scratch
  • Rename the first costume, penguin2-a to look front 
  • Rename the last costume, penguin2-d to look right
choose the look front penguin costume
  • To create a penguin looking left, right click and duplicate the look right costume
duplication the look right costume
  • Highlight the new costume in the paint canvas and click flip horizontal. You should now have a penguin looking left.
  • Rename this new sprite to look left
flip the costume horizontal

The final costumes will look like this:

rename the costume look left

Your penguin now has different costumes to show which direction he’s facing.

2. Change the costume with arrow keys

Go back to the Code tab to add code to the penguin sprite. Under each key press, we will switch the costume to match the direction the penguin is facing.

  • Under the when right key pressed, add a switch costume to look right
  • Under the when left key pressed, add a switch costume to look left
  • Under the when up key pressed, add a switch costume to look front
  • Under the when down key pressed, add a switch costume to look front
switch costumes block added to arro key blocks

Try pressing the arrow keys and see if your penguin is facing the right direction.

3. Set the costume when the game starts

But, when we press the green flag the penguin isn’t always facing forward.

  • Under the when green flag clicked block, add a switch costume to look front
switch costume to look front
completed code to switch costumes

Start the game over by pressing the green flag. Your penguin should start looking forward, then look right or left depending on which direction it’s moving. 

Now your penguin is animated to look like it’s walking.

Bonus: Add a timer 

We can add a timer to make the maze more challenging. Let’s give the player 60 seconds to complete the maze game before the penguin disappears.

1. Create a Time variable

A variable is used to hold information that changes. Our time decreases every one second, so we can use a variable to save that value.

  • Go to variable category, right-click my variable and rename it to Time
  • Check off the box next to the Time variable

You should see the Time variable in your game preview now.

2. Start the Timer 

If we want the player to have 60 seconds to play, we should set the timer to start at 60. 

  • Add a When green flag clicked block
  • From the variable category, drag a set Time to 60
set time to 60

Press the green flag to see the time reset.

3. Count down the timer

Use a loop to count down the timer every 1 second. 

  • Add a Repeat until loop under the set Time block
  • In the operators category, add a less than block in the repeat until loop. Repeat until Time < 1.
  • Add a wait 1 second block inside the loop
  • Then decrease the time variable using change Time by -1
loop to count down the timer
showing timer in game preview

Press the green flag to see the time counting down.

4. Show and hide the penguin

The penguin should show when the game starts, but hide after the time runs out. 

  • After the When green flag clicked block, add a show block
  • After the Repeat until loop, add a hide block
add show and hide blocks
show and hide penguin

That’s it! Press the green flag to test your timer one more time. It should be counting down the time and hiding the penguin once the time runs out.

Give yourself a pat on the back. You completed the maze game tutorial. See the complete game with bonuses and remix it

More Scratch Tutorials for Kids

Try making another Scratch game using a fun step-by-step tutorial:

Download Free Printable Scratch Coding Tutorials PDF

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

Code more games in Scratch!

Continue coding games in Scratch with the guidance of a live, expert instructor. We teach kids how to code and practice analytical thinking, computational thinking, problem-solving, and logical reasoning.

Kids, ages 8-10, who want to learn more about Scratch coding can join the Elementary School Core Track. We offer a structured Scratch curriculum with project-based learning for hands-on practice. Enroll today to get started.

Learn to make games in Scratch in our top-rated coding classes for kids.

The post How to Make a Maze in Scratch in 7 steps appeared first on CodeWizardsHQ.

]]>
How to Make a Game on Scratch with Levels https://www.codewizardshq.com/how-to-make-a-game-on-scratch-with-levels/ Tue, 16 Jul 2024 02:16:31 +0000 https://www.codewizardshq.com/?p=63882 Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

When kids develop their own games in Scratch, they can add different levels to make their game more fun and engaging. In this tutorial, I’ll show you how to create a game with levels in Scratch based on points. Leveling up in a game is one of the most satisfying feelings for any player. It’s […]

The post How to Make a Game on Scratch with Levels appeared first on CodeWizardsHQ.

]]>
Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

When kids develop their own games in Scratch, they can add different levels to make their game more fun and engaging. In this tutorial, I’ll show you how to create a game with levels in Scratch based on points.

Leveling up in a game is one of the most satisfying feelings for any player. It’s a sense of achievement and accomplishment that makes playing games so addictive!

📌 [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

Popular games like Super Mario, Legend of Zelda, or Final Fantasy all use levels to challenge players and present new skills, worlds, and opponents.

Kids can also learn Scratch coding in our top-rated coding classes for kids. They’ll code games with a live instructor and build projects in every class.

What is a game level in Scratch? 

A game level is part of a game that players must complete before advancing. Many games have progressive levels where players must complete every level to finish the game. 

Anything can happen in a new level! 

A new level can signal changes like increased difficulty, new challenges, location, characters, or gameplay. Levels can be represented in maps, stages, missions, courses, or rounds.

Leveling up in a game can depend on different factors too. Players may level up based on points, experience, goals, etc.

Some games use level as a ranking method. Players or characters have individual levels, like Pokemon cards and Minecraft. As the player gains experience, they level up, acquiring new abilities and access to new content.

Why add levels to your Scratch game?

Levels are a common feature in all types of computer, mobile, and online games. Some games even have hundreds or unlimited levels for players to conquer.

Game levels motivate players to keep playing. Adding levels to a game is a way to challenge players, give them a goal to work towards, and explain how to progress in the game. 

For game developers, adding levels helps control the gameplay and design. Levels can also carry forward the story or narrative of the game, immersing the players in the storyline. 

How do you add levels to a Scratch game?

There are many different ways to add levels in Scratch. You first need to decide on the game logic.  

How will players advance levels? 

Decide which factors will allow players to advance, such as time, points, actions, etc. In the Dragon Jam game, players advance by collecting a specific amount of strawberries.

What happens when a player advances levels? 

Decide what features will change at each level. This can include the location, characters, goals, etc. In our tutorial game, a new level signals a change in the location and the goal to reach the next level.

Once you’ve decided on the game logic for your levels, you can write the code to execute it.

Steps to Make a Game on Scratch with Levels

Complete this Scratch tutorial for kids to build a game with levels.

Scratch dragon game with levels

Play and remix the Dragon Jam game now.

What you need:

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

Step 1: Create a new Scratch project

Get started by creating a new project in Scratch. 

create a new scratch project

A new project will open up and you will see the Scratch interface.

scratch project interface

Now, we can code your game! 

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

Step 2: Add Sprites

We need a player (dragon) sprite and a loot (strawberries) sprite for our game.

  • Delete the cat sprite first. Click on the cat sprite and the trash can icon.
add sprites
  • Click on the “Choose a Sprite” button and select “dragon”. Resize it to 30.
  • Click on the “Choose a Sprite” button and select “jar”. Resize it to 30.
add sprites
resize sprites

Your player and your loot are all set! Next, add a backdrop.

Hint: Choose or paint your own sprites to create a different theme for your project. 

Step 3: Add a backdrop

Let’s start by adding one backdrop, when we switch levels we can add additional backdrops to each level.

  • Click the “Choose a Backdrop” icon and add the “Castle2” backdrop
add backdrop
choose a backdrop

You should now see your game background in the preview.

Add backdrops gif

Hint: Choose or paint your own backdrop to match the theme of your project. 

Step 4: Move the Dragon

Your player, the dragon, needs to move from side to side to catch the strawberries. 

Let’s add code to move the dragon right and left using arrow keys. We will use the “Events” blocks.

  • Click on the dragon sprite to add code to it
  • Add the “When space key pressed” block and change the dropdown to “right arrow”
  • Underneath that, add a “Change x by” block and use 15 to move right
  • Add the “When space key pressed” block again and change the dropdown to “left arrow”
  • Underneath that, add a “Change x by” block and use -15 to move left
arrow keys
move the dragon gif

Test it out, your dragon should move when you press the arrow keys! 

Hint: Change the 15 and -15 values to move your player faster or slower. 

Step 5: Make Falling Strawberries

Now, let’s make it rain strawberries. We need a lot of strawberries, so we will be making clones of the one strawberry sprite.

  • Click on the strawberry sprite to add code to it
  • Add a “When green flag clicked” block that will start our code
  • Add “Hide” block to hide the original sprite
  • Add a “Forever” loop 
  • Inside the loop, use the control blocks to “Wait 1 second” and “Create a clone of myself”
forever loop
make falling strawberries gif

Each new clone will fall towards the dragon from a random position at the top of the game screen.

  • Since the x position of the sprite changes every time, first make a new variable called x position to store it.
  • Uncheck the variable so it doesn’t show in your game screen.
update sprite positions
  • Add a “When I start as a clone” block
  • Add “Show” block so we can see the clone 
  • Go to x and y block, use the x position variable and 150 for the position
  • Use a “Glide” block to bring the strawberry down to a y position of -150
  • Delete the clone once it is off the screen
scratch blocks for glide
variables gif
variables gif

Click the green flag to watch your strawberries falling from the sky.

Hint: Change the number of seconds in Glide to make your strawberries fall faster or slower.

Step 6: Add a Score

Our player levels up based on the score, so we need to calculate a score in our code.

  • The score changes, so make a new variable called “score” to store it.
  • When a new game starts the score should be 0. Under “When green flag is clicked” add a “Set score to 0” block. 
add score in scratch

Next, increase the score every time the sprites touch. 

  • Add “When I start as a clone” block
  • Then, add a “Wait until” block and use the sensing block for “touching”. Change the dropdown to “Dragon” or your player sprite. 
  • Add a “Change by” block from variables to change the score variable by 1.
  • Finally, add a “Delete this clone” block to make the strawberry disappear
scratch blocks for touching
Add score gif

Move your dragon around to collect the strawberries and watch as the score increases!

Hint: Try adding different loot with higher or lower scores to make the game more interesting.

Step 7: Add Levels

Now, let’s make the game more challenging by adding levels. In each level, the player needs to collect more strawberries (or more points) to advance. So, think about the game logic.

How many strawberries does the player need to advance in each level? 

  • Level 1 Score 3 points to advance (total of 3 points)
  • Level 2 Score 5 points to advance (total of 8 points)
  • Level 3 Score 7 points to advance (total of 15 points)
  • Level 4 Score 10 points to advance (total of 25 points)
  • Level 5 Win!

What happens after the player advances a level? The backdrop will change. 

You’ve already added the backdrop for level 1. We will add 4 more backdrops for the other levels.

  • Click the “Choose a Backdrop” icon and add another backdrop. 
  • Repeat this 4 times with a different image each time. We are using the Savanna, Underwater 1, Mountain, and Metro backdrops

  • You can see all of the backdrops you chose in the “Backdrops” tab. If you have a default white background, click the trash can icon to delete it.
Add backgrounds for scratch levels
Add backgrounds for scratch levels gif

The location, or background, changes when players pass a level. We can write that in code like this:

  • First, click on the Dragon sprite to add code to it
  • The level changes, so make a new variable called “level” to store it.
  • Add a “When green flag is clicked” and a “Set level to 1” block. When a new game starts the level will begin at 1. 
  • Use “Switch backdrop to” and choose the backdrop you want for the first level.
  • Add a “forever” loop
  • Inside the loop, we will add an if statement for each change in level. For example, if the score is greater than 2, set the level to 2 and switch the backdrop to Savanna.
  • Copy the If statement and add the change in score, level, and backdrop for each level you have.

Press the green flag to play! You should see the levels increasing and the backdrop changing.

Hint: Customize your levels by changing the scores or backgrounds. 

Step 8 Win Logic

Players can collect strawberries and level up, but they don’t know when they win or lose. Let’s display a message to the player when they win.

On the Dragon sprite, we will add code inside the level 5 if statement.

  • Add a “Broadcast” block and change the message to “you win”
  • Add a “Stop all” block to end the game

Create a message to the player that they win.

  • Click on the cat icon, select “Paint” 
  • Select the rectangle option to draw a white rectangle
  • Then, select the text option and type “You Win” in red on top of the rectangle
  • Right-click on the sprite to name it “You Win”

We only want to show the “you win” sprite when the message is received.

  • On the “you win” sprite, add a “When Green flag is clicked” block and a “hide” block
  • Add a “When a receive” block and change the message to “you win”
  • Add a “show” block and “stop all” to end the game.

You should now see the win message when you reach a score of 25!

Hint: Test your win message by setting the score to start at 24 instead of 1. 

Step 9 Lose Logic

Now, display a message to the player when they lose.

On the strawberry, send a losing message when a strawberry reaches the floor.

  • Under the “glide” block, add a “forever” loop
  • Inside the loop, add an “If” statement with an operator for y position is less than -149.
  • Add “broadcast” and create a new message called “game over”
  • After the loop, add “delete this clone” block.

Create a message to the player that they lost,

  • Right-click on the “You Win” sprite and duplicate
  • Go to the Costumes tab and edit the text to “Game Over”
  • Right-click on the sprite to rename it “game over”

We only want to show the “game over” sprite when the message is received. Since you duplicated a sprite, the same code will also be on this sprite.

  • Update the “when I receive” block and change the message to “game over”

All of your game logic is complete! Play the Dragon Jam game.

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

You can “see inside” our completed Dragon Jam to get a peek at the full Scratch code.

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

Try making another game with levels. Pick one of these fun Scratch game tutorials and add levels.

Learn How to Make Games with Levels in Scratch

Coding games in Scratch is a great way for kids to learn about programming fundamentals and game development. 

If your child wants to dive deeper into Scratch, join our top-rated Scratch classes for kids. Students in our elementary school coding program learn to code with Scratch and advance to other languages like HTML/CSS, JavaScript, and Python. Learn from live, expert instructors while building fun projects and games that your child personalize and share.

Enroll today to start coding in Scratch!

The post How to Make a Game on Scratch with Levels appeared first on CodeWizardsHQ.

]]>
How to Make a Jumping Game on Scratch https://www.codewizardshq.com/how-to-make-a-jumping-game-on-scratch/ Wed, 28 Feb 2024 07:45:23 +0000 https://www.codewizardshq.com/?p=60835 Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

Hey there, young explorers! Ready to learn how to make a jumping game on Scratch? We’re building a Rocket Jump game where you’ll zoom through space going from platform to platform. Before we start building our game, let’s talk about Scratch. Scratch is a super cool place where you can make your own stories, games, […]

The post How to Make a Jumping Game on Scratch appeared first on CodeWizardsHQ.

]]>
Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

Hey there, young explorers! Ready to learn how to make a jumping game on Scratch? We’re building a Rocket Jump game where you’ll zoom through space going from platform to platform. Before we start building our game, let’s talk about Scratch. Scratch is a super cool place where you can make your own stories, games, and animations — like a digital LEGO set that’s all about your ideas!

📌 [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

It’s like learning to speak the language of computers! And the best part? You don’t have to type any words or numbers. Instead, you snap together colorful blocks that look a bit like puzzle pieces. Each block is a command that tells your characters and objects what to do.

In our elementary school curriculum, students start their coding journey with Scratch. As kids build games and animations with Scratch, they’re laying the groundwork for computational thinking—a vital skill set for coding with actual code. 

Let’s start our coding journey together!

Complete this tutorial to create a jumping game on Scratch.

Play and remix the Rocket Jump game now.

What you need:

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

Steps to make a jumping game in Scratch:

  • Step 1: Setup the scratch project
  • Step 2: Make the rocket move with keyboard keys
  • Step 3: Add “gravity” to make the rocket fall.
  • Step 4: Add the platform
  • Step 5: Make the rocket jump when touching the platform.
  • Step 6: Change platform position everytime rocket touches it.
  • Step 7: Add scores in the game.
  • Bonus 1: Change costumes of the Rocketship sprite
  • Bonus 2: Increase difficulty as the game progresses

In this game, players guide a rocketship through the starry cosmos using the arrow keys to navigate left and right. The rocket automatically falls due to gravity, but upon touching the platform, it jumps upwards to earn points. Each successful landing on the platform boosts the rocket higher and changes the platform’s position, making each jump a new challenge. The aim is to keep the rocket aloft as long as possible while racking up jumps for a high score.

Step 1: Setup the Scratch project

Create a New Scratch Project

  • Open Scratch, and you’ll see a button that says “Create”. Click it, and you’re on your way!
  • At the top, you’ll find the name “Untitled”. Click on it and type in “Rocket Jump” to name your game.


Set the Stage

  • Every game needs a background. Look at the bottom-right corner for a little picture that looks like mountains. That’s the backdrop. Click it!
  • Choose a backdrop with stars to make it look like outer space. You can pick one or even draw your own.
choose a game background
  • Next, click on the picture of the cat to select a sprite. You can pick a rocket from the ones they have. 
choose a scratch sprite
  • Set its size as per your need. For rocket sprite, a size of 40 works the best.
resize the rocket in the jumping game

After we have both backdrop and sprite setup, you should have something like below in the game preview area:

Step 1 results, rocketship sprite with background

Step 2: Make the rocket move with keyboard keys

Moving Right

  • Let’s get our rocket moving. Click on the Events category, and you’ll find a block that says “when space key pressed”. Drag it out.
  • We want to move right when we press the right arrow, so click on the little dropdown arrow on that block and choose the “right arrow”.
  • Now, click on the Motion category (it’s the blue one), and find “change x by 10”. Drag that and snap it right under the “when the right arrow key pressed”.
move the rock et right and left

Moving Left

  • Our rocket should move left too! Let’s duplicate the blocks you just made. Right-click on them and choose “duplicate”.
Duplicate blocks to move
  • Change “right arrow” to “left arrow” and “10” to “-10”. Now, when you press the left arrow, your rocket will move left!
Add arrow key to move

Step 3: Add “gravity” to make the rocket fall.

Setting the Fall

  • In space, things float down slowly. We’ll make our rocket do that. Find the Events category again and use the “when green flag clicked” block.
  • We need to tell the rocket where to start. Go to Motion, find “go to x: y:” and fill in “x: -144” and “y: 123”.
  • To make it keep falling, go to Control (the orange category), find “forever,” and drag it under your “go to” block.
  • Inside “forever,” go back to Motion and find “change y by”. Put “-4” in it to make our rocket fall.
Add gravity to make the rocket fall

Step 4: Add the Platform

Creating the Platform

  • Our rocket needs a platform to jump from. Click the paintbrush to make a new sprite.
  • The click the square icon and draw a rectangle at the center of the screen. This is your platform. It can be any color you like!
Create a platform for your jumping game

Positioning the Platform

  • Let’s put the platform in place. Under Events, use “when green flag clicked” again.
  • In Motion, find “go to x: y:” and fill in “x: -154” and “y: -55”. That’s where the platform will wait for our rocket.
position the platform for the rocket to jump on

Step 5: Make the rocket jump when touching the platform.

The rocket jumps!

  • We want our rocket to bounce when it touches the platform. Inside the rocket’s “forever” loop, add the “if then else” block from the Control category. 
  • From the Sensing category (it’s the light blue one), grab “touching” and select the “Sprite1” (your platform sprite) from the dropdown.
  • In the “else” part, move the “change y by -4” block you made before.
  • For the “if” part, first, we make the rocket jump. Grab “repeat” from Control and type “15” in it.
  • Inside “repeat,” add “change y by 4” from “Motion” and “wait 0.05 seconds” from Control after it. This makes the rocket go up for a bit, like it’s bouncing!
make the rocket jump when touching platform
make the rocket jump when touching platform

Step 6: Change the platform position every time the rocket touches it.

Moving the Platform

In the rocketship sprite

  • We’ll make the platform move every time the rocket jumps. In the rocket’s code, in the “if” part, find Events and use “broadcast message1”.
change the platform position in scratch

In the platform sprite

  • Wait for that broadcast message. Use “when I receive message1” from Events
  • To change the spot, use “glide 1 secs to x: y:” from Motion.
    • Set the value of y with y position block from the Motion category. This will make sure the platform remains at the same height.
    • For x, add a random block from Operators category, and set the lower limit to -200 and upper limit to 200
broadcast message to glide

This completes our game logic, we can now move our rocket to go left and right, and use the platform to stay afloat.

rocketship jumping, game logic complete

Step 7: Add scores in the game.

Keeping track of scores

A game is no fun without the scores. To set up scores, create a new variable named Scores.

  • Click on the Variables category and choose “Make a Variable”
  • Name it Scores, press ok, and you should see it appear in your variables list. Make sure it’s checked off so it shows in your game.
make a scores variable

In your rocketship sprite, 

  • Drag the set the value of Scores variable and position it below the “When flag clicked”. Set its value to 0.
  • Inside the if condition, in the “forever” block, add the change value by 1 block. And select the Scores variable from the dropdown.
set the score in the jumping game

Your game is complete!

Bonus 1: Change costumes of the Rocketship sprite 

Change costume when jumping

To add the rotate effect in the rocket, we can change its costume when it goes up.

In the Rocketship sprite

  • Drag the “next costume” block from the looks category, and place it inside the repeat 15 block, in the if condition.
  • To reset the costume, drag the “switch costume to” block from the Looks category, and place it below the “when green flag clicked” block.
  • Select the default costume value. For the rocketship sprite, the costume rocketship-e makes perfect sense, as it doesn’t have any ignition.
change costumes
completed jumping game in scratch

Bonus 2: Increase difficulty as the game progresses

Draw more costumes in platform sprite

To increase the difficulty of the game, add costumes to the platform sprite with a smaller size of platform.

  • Select the platform sprite, and go to the Costumes tab.
  • Right click on the Costume, and select duplicate.
  • Decrease the size of the platform in the duplicated sprite.

In the Code tab of the platform sprite,

  • Add the “if then” block from the Control category and place it below “when I receive message1” block.
  • For the condition of the “if” block, use the > block from the Operators category.
  • Inside > block, add scores variable on left side, and any value of scores when you want to change platform on right side. For example, we can use 15.
  • Inside the “if” block, add the “Switch Costume” block from the Looks category, and select the costume with decreased size.
  • Add another switch costume block and place it below the “when green flag clicked” block. 

Let’s play!

It’s time to test your game by pressing the green flag above your game’s screen. 

Compete with your friends and see who can score the most scores.

Download Free Printable Scratch Coding Tutorials PDF

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

Make More Games in Scratch

CodeWizardsHQ firmly believes that initiating the exploration of technology and programming during childhood can pave the way for future success. We have designed a structured program for elementary school coding, that leverages the power of Scratch to teach coding principles.

In the first course, Animation and Games with Scratch, students delve into essential programming concepts, including variables, loops, and conditionals. By the end of this course, they will possess the ability to create their own games and animations using Scratch. This prepares them for their journey toward a future in the ever-evolving world of technology.

Our coding classes for kids allow children to nurture their skills, unleash their imaginations, and experience the joy of learning!

The post How to Make a Jumping Game on Scratch appeared first on CodeWizardsHQ.

]]>
5 Popular Game Mechanics in Scratch [60 Second Lessons] https://www.codewizardshq.com/5-popular-game-mechanics-in-scratch/ Sat, 13 Jan 2024 01:30:13 +0000 https://www.codewizardshq.com/?p=58749 Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

Moving, jumping, and scoring are standard features in almost every game we play. Kids can learn how to add these popular game mechanics to their Scratch games in just a few clicks. In our elementary school coding classes, kids use Scratch to code their own games that they can play and share with friends. When […]

The post 5 Popular Game Mechanics in Scratch [60 Second Lessons] appeared first on CodeWizardsHQ.

]]>
Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

Moving, jumping, and scoring are standard features in almost every game we play. Kids can learn how to add these popular game mechanics to their Scratch games in just a few clicks.

In our elementary school coding classes, kids use Scratch to code their own games that they can play and share with friends. When they are beginners, they’re often asking how to include these simple game mechanics and it’s easier than they think.

Here are five popular game mechanics that take just 60 seconds to add to any game in Scratch.

  1. Move left and right
  2. Add gravity
  3. Jump
  4. Follow the Mouse
  5. Keep Score

Kids Can Quickly Code Games in Scratch

Scratch is a free block coding language and online community that allows kids to create programs and games using drag-and-drop. 

Scratch is an excellent choice for kids who want to build games fast. There’s no setup and the drag-and-drop coding interface is easy enough for any beginner. In Scratch, kids can really focus on understanding coding concepts rather than learning syntax.

We teach these fundamental concepts through engaging projects in our Scratch classes. Elementary school students learn to code games and apps using Scratch first. This helps them build a solid understanding of fundamental coding concepts before they move on to text-based coding.

What are game mechanics? 

Basic game mechanics refers to the fundamental rules, interactions, and systems that govern how a game operates.

These make up the core framework of a game, shaping the player’s experience and defining the rules of engagement within the game world. 

When you start a new game, you learn the basic mechanics first in order to play. 

Game developers use basic game mechanics to create engaging and enjoyable gameplay, providing structure, and a sense of progression for players. A few examples include:

Player Controls: Player controls define how users interact with the game. This includes keyboard and mouse inputs, gamepad controls, touch gestures, or any other input method.

Developers design controls to be intuitive and responsive, allowing players to navigate the game world, perform actions, and interact with objects.

Objectives and Goals: Games typically have specific objectives or goals that players must achieve to progress. These objectives can include completing missions, solving puzzles, defeating enemies, or reaching a specific destination. Well-designed objectives create a sense of purpose and motivation for players.

Scoring and Rewards: Scoring systems track players’ performance and provide a quantifiable measure of success. Rewards, such as points, items, or in-game currency, are often tied to achievements and milestones. Scoring and rewards incentivize players to strive for improvement and mastery.

Physics and Collision Detection: Physics engines simulate realistic movement and interactions within the game world. This includes gravity, friction, and object collisions. Collision detection ensures that objects interact believably, contributing to a more immersive and coherent game experience.

You can see some of these at work in the 25 best Scratch games.

5 Popular Game Mechanics in Scratch

Watch the 60-second Scratch video lessons to add these features to your next game! 

1. Move Left and Right 

Moving left and right is a fundamental part of many games, particularly in 2D platformers and side-scrolling games. This basic movement mechanic may seem simple, but it plays a crucial role in the gameplay experience. It can also influence player control, level design, pacing, and even contribute to the narrative impact of the game. 

In the Rocket Landing game, the rocketship moves left and right.

If we want our rocket to move left and right, we need to change the X value.

  • In your code, select the When Key Pressed block then choose right arrow. 
  • Use a motion block to Change X by 5.
  • Use the When Key Pressed block again then choose left arrow. 
  • Then use the motion block to Change X by -5.
  • Now, press the green flag and use the arrow keys to test your movement. 

Add this to your Scratch code:

Scratch code for right and left

2. Add Gravity

Incorporating gravity into a game world will add realism and can be an added layer of challenge. Games that involve falling or flying heavily depend on gravity. Changing gravity can lead to shifting landscapes, floating platforms, or other dynamic elements that keep the gameplay experience fresh and unpredictable.

In our Rocket Landing game, the rocketship falls from the sky.

If we want our rocket to move from top to bottom, we need to change the Y value.

  • In your code, drag a When Green Flag clicked block in events.
  • Select the Repeat loop and loop 200 times.
  • Use a motion block to change Y by -2. Put that inside the loop, so the rocket goes down by -2 , 200 times. 
  • After it falls, set it back to the top with the Go To block x = 0 and y = 130 
  • Now, press the green flag to test your rocket. It’s falling!

Add this to your Scratch code:

Scratch code for gravity

3. Jump

Jumping is another fundamental game mechanic that you’ll see in virtually every game. Players can jump to navigate vertically, overcome obstacles, or reaching higher platforms. The ability to jump make a game more dynamic because they can introduce features like moving platforms or changing landscapes that require players to adapt their jumping skills in real-time.

In the Frog Jumper game, the frog jumps over a snake when you click the spacebar.

To move the frog up and then down, we need to change the Y position in Scratch.

  • In your code, select a When Space Key Pressed block in events.
  • Use a motion block to Change Y by 15. 
  • Select the repeat loop and repeat the change in Y 15 times. Add this around the motion block.
  • Right-click to duplicate your loop and change Y to -15. This moves the frog down.
  • Now, press the green flag to test your frog. It jumps!

Add this to your Scratch code:

Scratch code for jumping

4. Follow the Mouse

The “Follow the Mouse” game mechanic, also known as mouse tracking or mouse-based control is important in certain types of computer games. It is crucial in certain genres like point-and-click adventures or real-time strategy games. Players may move the cursor with the mouse to explore the environment, interact with objects, or solve puzzles.

In the Candy Collector game, the ghost follows the mouse. Anytime the mouse moves our ghost will move.

  • Add a When Green Flag clicked block.
  • Choose the motion block for Go To and select mouse-pointer.
  • We want the ghost to follow the mouse pointer forever, so use a forever loop. 
  • Put it around the Go To block to repeat that action.
  • Click the green flag and move your mouse. Does your sprite follow your mouse?

Add this to your Scratch code:

Scratch code for follow the mouse

5. Keep Score 

Keeping score is a fundamental game mechanic that serves various purposes across different types of games. Whether it’s a simple arcade game or a complex strategy game, the scoring system adds a competitive element to games, motivating players to improve their skills and achieve higher scores. It also provides clear goals for players to achieve and gives immediate feedback on player performance. 

In the Monkey Tickler game, the score goes up when you click on the monkey.

  • The score changes, so first go to variables and Make a Variable called score.
  • In your code, drag a When Green Flag clicked block in events.
  • Set the score variable to 0 when you start your game.
  • Then, get the event block When This Sprite is Clicked.
  • Every time we click the sprite, the score will change by 1. 
  • In variables, get Change Score by 1.
  • Now, press the green flag to test your game.
  • The score increases when you click your sprite.

Add this to your Scratch code:

scratch code for scoring

Take your Scratch skills to the next level.

Now that you have your basic game features, take your Scratch skills to the next level! The elementary school core track, for kids ages 8-11, is a structured and fun way to advance your child’s coding skills. Kids will build a foundation in coding and practice skills like logical reasoning, problem-solving, and critical thinking. 

Encourage your child to learn Scratch and empower the next generation of creators. See Scratch classes and enroll.

The post 5 Popular Game Mechanics in Scratch [60 Second Lessons] appeared first on CodeWizardsHQ.

]]>
How to Make a Platformer on Scratch https://www.codewizardshq.com/how-to-make-a-platformer-on-scratch/ Mon, 25 Sep 2023 02:23:30 +0000 https://www.codewizardshq.com/?p=57710 Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

In this tutorial, I’m going to show you how to make a platformer game in Scratch. Scratch is a simple drag-and-drop coding language for children to learn basic programming skills. Kids can build all kinds of games and apps in Scratch. With the Scratch classes I’ve taught, kids always enjoy the exceptional interactivity and enjoyment […]

The post How to Make a Platformer on Scratch appeared first on CodeWizardsHQ.

]]>
Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

In this tutorial, I’m going to show you how to make a platformer game in Scratch. Scratch is a simple drag-and-drop coding language for children to learn basic programming skills. Kids can build all kinds of games and apps in Scratch.

With the Scratch classes I’ve taught, kids always enjoy the exceptional interactivity and enjoyment Scratch offers. In our Elementary School Core Track, students can craft their own interactive games while learning fundamental programming concepts like variables, loops, and more.

📌 [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

Try this tutorial to learn about accepting user input, adding player controls, checking for collisions between two sprites, and more. Let’s get started!

Play and remix the Chick’s Adventure game now.


What you need:

  1. Scratch account: Create a free Scratch account

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

How to Make a Platformer on Scratch

  1. Set up the Project
  2. Set the Scene
  3. Add Gravity to the sprite
  4. Add platforms for the sprite to jump on
  5. Add the user controls
  6. Change the levels
  7. Bonus: Make a way to win or lose

Step 1: Set up the Project

In this section, you will create a new Scratch project, give it a name, and save it so you can get started on your platformer game!

1. Login to Scratch

2. Create a New Scratch Project

  • Once you are logged in, click the Create button at the top of the page.

3. Name the project and delete the Scratch cat

  • In the top textbox on the Scratch editor, name your project whatever you would like!
  • Then, delete the Scratch cat by clicking the trash can next to the sprite in the spite area.

4. Save the project

  • Click File, then Save now. You’re now ready to make your platformer game!

Step 2: Set the Scene

For this section, you will add the backdrop and a sprite for the player to control, which will set the scene for your platformer game! 

1. Add a backdrop to your game!

  • Click on the Add a backdrop button on the bottom right-hand side of your editor.

  • Choose whatever backdrop you’d like! I chose Blue Sky 2 for my project. When you’re ready, click your chosen backdrop.

Great, now your backdrop should show up!

2. Select a Player Sprite

  • On the bottom right-hand side of your page, click on the Choose a Backdrop button.
  • Click any sprite you would like. In this tutorial, I decided to select the Chick sprite.
  • You can change the size of the sprite if you’d like as well. Edit the Size textbox in the sprite area to do this!

Awesome job, you should now have a sprite on your screen that is sized how you want. Click and drag the sprite around to move it to a new spot!

Step 3: Add Gravity to the Sprite

In this section, you will learn how to use multiple motion blocks to change the player’s position and move them downwards on a loop, which will simulate gravity.

1. Detect when the game is being played

  • In the Code block tab, click on the Events category.
  • Then, select the When Green Flag clicked block and drag it into your code area.

2. Make the sprite move downwards on a loop

  • Go to the Control category and drag a forever block into the code area and attach it under the When green flag clicked block.


  • Then, go to the Motion category and click and drag a change y by block. In the textbox, you can change the number if you’d like. The higher the number, the faster they fall.


  • Change the number in the change y by textbox to a negative number to make it go downwards.


3. Set the sprite’s initial position

  • In the Motion category, click and drag a go to x and y block and connect it under the when green flag clicked block, but above the forever block.

  • Press the Green Flag above the game area. Does your sprite fall? Every time you press the Green Flag, your sprite should start from the beginning and fall down!

Step 4: Add platforms for the sprite to jump on

In this section, you will add platforms for the player to jump on to avoid falling. Once the player touches a platform, you will make it so gravity turns off until they aren’t touching the platform anymore!

1. Add a platform for the sprite

  • In the bottom-right corner of the Scratch editor, click Choose a Sprite.

  • Choose whatever sprite you want in the menu. For this tutorial, I chose the Clouds sprite.

  • Move the new sprite to a position under the player’s sprite and press the Green Flag button. Does it work as intended?

2. Make it so the sprite can’t go through the platform

  • Click on the Chick sprite. Make sure that it is selected before moving on to the next step.

  • Then, in the Code tab, go to the Control category and click and drag an if then block to under the change y by block.

  • Go to the Sensing category and drag a touching block into the code area. Click the block and change the dropdown selection to the sprite you recently added to the game. In my case, I selected the Clouds sprite.

  • In the Motion category, drag a change y by block to be in the if then block. Make sure that the number in the change y by block is the positive version of the one outside of the if then block. If you had a -10 in the first change y by block, you should have a 10 in the new one.

  • Press the Green Flag button. Does your player sprite stop when it touches the platform?

Recommended: How to Make a Game on Scratch

Step 5: Add the user controls

In this section, you will allow the player to move their sprite back and forth in the game, which will make it so they can eventually switch levels. You will also make it so the player can jump from platform to platform!

1. Allow the player to move left or right

  • In the Control category, drag two if then blocks to inside the forever block.


  • Then, go to the Sensing category and drag two key pressed blocks into the if then blocks you added. Change one of them to left arrow and the other to right arrow in their dropdowns.


  • Go to the Motion category and drag two move steps blocks into the left and right arrow key pressed blocks. Keep them both the same number.


  • Next, in the Motion category, drag a point in direction block into both the key pressed blocks. Then, change the number in the left arrow key pressed block to -90. The right arrow one should be 90.


  • In the Motion category again, drag a set rotation style block to under the Green Flag clicked block.



Great work so far! Does your sprite move back and forth with the left and right arrow keys?

2. Make the player jump

  • Go to the Events category and drag a when key pressed block into the code area. Change the dropdown in that block to up arrow or spacebar.


  • Then, in the Control category, drag a repeat block under the when key pressed block.

  • Get a change y by block from the Control category and place it in the repeat block. Change the number in the change y by block to be about 15, or a number bigger than the gravity number.

  • To add a delay between jumps, go to the Control category and drag a wait block under the repeat block.

  • Press the Green Flag button, does the sprite jump when you press the up or spacebar key?

Step 6: Change the levels

In this section, you will create a checkpoint that the player must touch to switch to the next level. You will be able to use your creativity to develop multiple levels using this method.

1. Add a checkpoint

  • Choose another sprite to serve as a checkpoint the player has to get to in order to get to the next level. For my project, I chose a Sun sprite. Feel free to change the size of the sprite as well.


2. Change levels when the checkpoint is touched

  • Go to your Code tab and select My Blocks. Then, click the Make a Block button.


  • There will be a popup. In that window, change the name in the textbox to Next Level. Then, click the Ok button.


  • You will notice a define block in your code area now. This is called a function, and basically is a small segment of code that performs an action. We will use it to change levels!



  • Then, attach a go to x and y block to the define block. Make sure the x and y values are similar to the ones you originally created in the when green flag clicked block.


  • Next, in the Events category, click and drag a broadcast block in to the define block as well. In the text portion, change it to something like Next Level.


  • Click on the checkpoint image in the sprites list area on the right of the page to make sure you’re changing the correct sprite. Then, in the Events category, move a when I receive block to the code area. It should say When I receive Next Level.


  • Then, from the Looks category, drag a next costume block under the when I receive block.


  • Then, click on the Costumes tab for your platform. You can click the Zoom out button – shaped like a magnifying glass with a minus on it, which is situated in the bottom right corner of the picture editor. This allows you to edit more of the image all at once.


  • Create another platform for the player to jump on by clicking and dragging to select the whole drawing. Then, click the Copy and the Paste buttons, and drag the new one to a better position.


  • You should now have two platforms to jump on!


  • Next, get an if then block from the Control category and drag it under the if right arrow pressed block.


  • Then, find a touching block from the Sensing category and put it in that newly added if then block.



  • Go back to the My Blocks category and click and drag the Next Level block into that if then block.



  • Click on the Platform sprite again. From the Events category, add a when green flag clicked. Then, go to the Looks category and put a switch costume to block to reset the platforms whenever the game is started.



Nice job! Do the platforms switch? From here, you can adjust each costume to make new levels.



Bonus Step: Make a way to win or lose

In this bonus section, you will make a way for the player to win by reaching a certain level, or lose by falling from the platforms! You will also create win and lose game screens for when this happens.

1. Create the win and lose backdrops

  • First, click on the Backdrops section on the bottom right of the editor in the Stage menu.


  • Once you do that, click on the Backdrops tab. Then, right-click on the backdrop you’re using in this project. Click duplicate to make an exact copy.


  • When you’re in the new backdrop, click on the Text button in the menu. Edit the text to say something like You Win!


  • Next, right-click and duplicate that new backdrop with the text as well.


  • Click the text and edit it to say something like You lose. Now you should have both the win and lose backdrops in your game!


2. Make the player lose if they fall off the platform

  • First, click on the player’s sprite. Then, go to the Looks category and get a switch backdrop to block and drag it under the when green flag clicked block. Make sure to set the backdrop to the first backdrop – not the win or lose ones. This is so that it resets whenever the player starts the game again.


  • Then, select Paint a new sprite.


  • In the Costumes tab of the new sprite, make a rectangle that is positioned at the bottom of the game screen. We’ll make it so that when the player touches this, they lose.


  • Then, go to the Code tab again and drag an if then block in the main forever block loop.


  • Next, go to the Sensing category and get a touching block and move it into the condition of the if then block you just added. Change the dropdown selection to the new sprite you created.


  • Now, go to the Looks category, get a switch backdrop to block, and change the dropdown selection to the lose backdrop.


  • Finally, go to the Control category and get a stop all block. Place it under the switch backdrop to block.


Does the lose screen display when the player falls off a platform?



3. Make the player win if they beat the last level

  • Select the platform sprite. Then, go to the Control category and place an if then block under the next costume block.


  • Then, go to the Operators category and grab a contains block. Put that in the if then block.


  • Go to the Looks category and put a costume number block in the left textbox of the contains block.


  • Finally, go to the Looks category and get a switch backdrop to block and put it in the if then block. Make sure it goes to the You Win backdrop.


Test your game, can you win?

Check Out Our Other Scratch Tutorials

Keep coding with one of these fun Scratch tutorials!

  • How to Make a Flappy Bird Game – Make an interactive game where the player must make a bird flap its wings to avoid incoming obstacles!
  • Flying Space Cat – Assist Space Cat in its space exploration mission by developing an enjoyable crystal-collecting game using the Scratch programming platform.
  • Code a Rocket Landing Game – Finish this Scratch programming tutorial designed for children and create a game where you safely land a rocket.
  • Valentines Day Card Scratcher – Create a Valentine’s Day scratch-off card with a personal touch by following this easy-to-follow Scratch programming tutorial.
  • Holidays Advent Calendar – Use Scratch to program a customized Advent Calendar for the holiday season and gradually unveil presents, treats, or activities to share with your friends adn family.
  • Halloween Candy Collector Game – Follow this simple Scratch programming tutorial and create a personalized game where you collect candies on Halloween.

Download Free Printable Scratch Coding Tutorials PDF

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

Try a Scratch Coding Class for Kids

At CodeWizardsHQ, we believe that learning about technology and programming during a student’s formative years can pave the way for future success. Our specialized program tailored for elementary school children utilizes Scratch as a foundational tool for imparting coding skills.

In our inaugural course, Animation and Games with Scratch, young learners delve into crucial programming concepts such as variables, loops, and conditionals. Upon completing this course, they will possess the proficiency to craft their own games and animations through Scratch, thus equipping them for more advanced coding endeavors and a promising future in the realm of technology. Our program fosters the development of children’s skills and imagination, all while ensuring an enjoyable and educational experience.

The post How to Make a Platformer on Scratch appeared first on CodeWizardsHQ.

]]>
How to Make a Sprite Jump in Scratch https://www.codewizardshq.com/how-to-make-a-sprite-jump-in-scratch/ Fri, 16 Jun 2023 09:33:35 +0000 https://www.codewizardshq.com/?p=56532 Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

Scratch is an excellent coding language for children to acquire programming skills. With Scratch, kids can construct games, narratives, and animations by simply dragging and dropping various blocks of code. In the Scratch classes I’ve taught, students confirm the exceptional interactivity and enjoyment Scratch offers. The Elementary School Core Track teaches kids to craft their […]

The post How to Make a Sprite Jump in Scratch appeared first on CodeWizardsHQ.

]]>
Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

Scratch is an excellent coding language for children to acquire programming skills. With Scratch, kids can construct games, narratives, and animations by simply dragging and dropping various blocks of code.

In the Scratch classes I’ve taught, students confirm the exceptional interactivity and enjoyment Scratch offers. The Elementary School Core Track teaches kids to craft their own interactive games while learning fundamental programming concepts like variables, loops, and more.

📌 [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

In this tutorial, I will teach you how to make a sprite jump in the Snake Jumper game. You will learn about animating sprites, accepting user input, and checking for collisions between two sprites. Let’s get started! 

Play and remix the Snake Jumper game now.

Snake jumper game in Scratch

What you need:

  1. Scratch account: Create a free Scratch account

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

How to Make a Sprite Jump in Scratch

  1. Login to Scratch
  2. Create a new Scratch project
  3. Name your new Scratch project
  4. Choose a backdrop
  5. Choose a sprite
  6. Make the sprite move up
  7. Make the sprite move down
  8. Change the sprite’s costume
  9. Reset the sprite’s position
  10. Test your game!
  11. Bonus – Add an enemy sprite to avoid

1. Login to Scratch

Login to scratch

2. Create a New Scratch Project

  • Once you are logged in, click the blue Create button at the top of the page.
create a new project in scratch

3. Name your new Scratch project

  • Give your project a name, for example, “Snake Jumper Game”. 
  • Then delete the Scratch cat by clicking the trash can icon next to the sprite.
Name your new scratch project

4. Choose a backdrop

  • Select the Choose a Backdrop option at the bottom right-hand side of your screen.
Choose a backdrop
  • When the Choose a Backdrop screen opens up, select a background for your project. In this tutorial, I chose Jungle.
Select the jungle scratch backdrop

5. Choose a sprite

  • Select the Choose a Sprite option at the bottom right-hand side of your screen.
choose a sprite
  • Select a sprite that you would like. I chose a wizard-toad for my project.
Select the wizard toad sprite
  • Click and drag the sprite to be on the bottom left side of the game. Then, in the Size textbox, change the size to about 75.
Position the wizard toad sprite

6. Make the sprite move up

The action of jumping is simply moving a sprite up and then back down. We will be moving the sprite when the space bar is clicked. 

  • In the Events category, drag a when space key pressed block in the code area.
make the sprite move up
  • Then, go to the Control category and drag a repeat block and attach it under the when space key pressed block.
  • Change the text in the textbox from 10 to 15, which will make the repeat block execute more times.
Add a repeat button
  • Next, go to the Motion category, and attach a change y by block inside of the repeat block. Change the text in the textbox from 10 to 15 so that the sprite’s y position changes quicker.
add a change y by block

7. Make the sprite move down

The sprite went up, now it must come down automatically. That will complete the act of jumping after the space bar is clicked.

  • Right-click on the repeat block and select Duplicate. This makes an exact copy of the repeat block and everything in it.
Make the sprite move down
  • Attach the new repeat block under the old one. Then, change the value in the change y by block to -15.
Add another repeat block

8. Change the sprite’s costume

When the sprite moves, you can change how it looks so it appears as though it’s actually jumping.

  • Go to the Looks category and get a switch costume to block. Attach it directly under the when space key pressed block, but above the repeat blocks. If you’re using the wizard-toad sprite, make sure the costume is set to wizard-toad-b.
Change the sprites costume
  • Drag another switch costume to block under all of the code. If you’re using the wizard-toad sprite, change the costume to wizard-toad-a by clicking on the costume name.
Add a switch costume to

9. Reset the sprite’s position

  • Then, go to the Motion category and drag a go to x and y block under the when green flag clicked block. Make sure the x value is about -175 and the y value is around -110.
Add a go to x and y block
  • Then, go to the Motion category and drag a go to x and y block under the when green flag clicked block. Make sure the x value is about -175 and the y value is around -110.
Add a motion block

10. Test your game!

  • Test your game by pressing the green flag above your game’s screen. Does your frog jump when you press the space bar?

Bonus – Add an enemy sprite to avoid

  1. Add another sprite
  2. Make the enemy sprite move
  3. End the game if the sprites collide
  4. Test your game!

1. Add another sprite

  • In the bottom-right corner of your screen, select the Choose a Sprite option.
Choose a sprite
  • Select a sprite of your choice. In this tutorial, I chose a Snake.
Choose the snake sprite
  • When that sprite is added, drag it to the right-hand side of the screen.
  • If the sprite is facing the wrong way, click on the Direction textbox for the sprite. Select the middle option under the clock. Then, change the 90 in the Direction textbox to -90.

  • You can also change the size of the sprite in the Size textbox. I changed mine to 75.
Change the size of the sprite

2. Make the enemy sprite move

  • Click on the new sprite.
  • In the code, add a when green flag clicked block from the Events category.
Make the enemy sprite move
  • Then, in the Control category, attach a forever block to the when green flag clicked block.
Add a forever block
  • Next, go to the Motion category and drag a go to x and y block into the forever block. Make sure the x value is about 300 and the y value is -100. This is so that the snake moves from the right side of the screen to the left!
Add a go to x and y block
  • Then, from the Control category, get a wait block and attach it under the go to x and y block. Change the value of the wait block to about 0.5.
Wait block in scratch
  • From the Motion category, drag a glide block to an x value of 300 and a y of -100.
Add a glide block

3. End the game if the sprites collide

The goal is for the frog to jump over the snake and not touch it. If the two collide, the game is over.

  • In the Events category, drag a when green flag clicked block into the code area.
When green flag clicked
  • Then, get a forever block from the Control category.
Add a forever block
  • Get an if then block from the Control category and put it in the forever block.
Add an if then block
  • Go to the Sensing category and get a touching block. Put that inside the if then block as a condition. Then, change the text from mouse-pointer to wizard-toad, or whatever other sprite you chose for the player.
Add a sensing condition
  • Go to the Control category and drag a stop all block in the if then block.
Add if then block

4. Test your game!

  • Click the green flag to start your game. Can you jump over the enemy sprites and end the game when they collide? 

Your game is complete! 

Take a look at the final product, your Snake Jumper game is complete. Play Snake Jumper.

More Scratch Tutorials & Games

Check out these other fun Scratch project tutorials and games!

Now that you know how to make a sprite jump, you can add it to any of your own projects.

  • Flying Space Cat – Assist Space Cat in its space exploration mission by developing an enjoyable crystal-collecting game using Scratch programming platform.
  • Code a Rocket Landing Game – Finish this Scratch programming tutorial designed for children and create a game where you safely land a rocket.
  • Valentines Day Card Scratcher – Create a Valentine’s Day scratch-off card with a personal touch by following this easy-to-follow Scratch programming tutorial.
  • Holidays Advent Calendar – Use Scratch to program a customized Advent Calendar for the holiday season and gradually unveil presents, treats, or activities to share with your friends and family.
  • Halloween Candy Collector Game – Follow this simple Scratch programming tutorial and create a personalized game where you collect candies on Halloween.

Download Free Printable Scratch Coding Tutorials PDF

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

Try a Scratch Coding Class for Kids

CodeWizardsHQ firmly believes that initiating the exploration of technology and programming during childhood can pave the way for future success. We have designed a structured program for elementary school coding, leveraging the power of Scratch to teach coding principles.

In the first course, Animation and Games with Scratch, students delve into essential programming concepts, including variables, loops, and conditionals. By the end of this course, they will possess the ability to create their own games and animations using Scratch. This prepares them for their journey toward a future in the ever-evolving world of technology.

Our coding classes for kids allow children to nurture their skills, unleash their imaginations, and experience the joy of learning!

The post How to Make a Sprite Jump in Scratch appeared first on CodeWizardsHQ.

]]>
How to Make Flappy Bird on Scratch https://www.codewizardshq.com/how-to-make-flappy-bird-on-scratch/ Fri, 28 Apr 2023 19:04:44 +0000 https://www.codewizardshq.com/?p=55986 Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

Scratch is a great tool for kids to learn how to code and it’s completely free! Anyone can use Scratch to make fun games, stories, and animations by dragging and dropping different blocks of code. It’s really easy to use and perfect for beginners who want to be creative and solve problems with coding. In […]

The post How to Make Flappy Bird on Scratch appeared first on CodeWizardsHQ.

]]>
Online coding academy for kids and teens ages 8-18. Enroll to learn real-world programming languages like Python, Java, HTML/CSS, JavaScript, and more!

Scratch is a great tool for kids to learn how to code and it’s completely free! Anyone can use Scratch to make fun games, stories, and animations by dragging and dropping different blocks of code. It’s really easy to use and perfect for beginners who want to be creative and solve problems with coding. In this article, I’ll show how to make a flappy bird game on Scratch without any text-based code.

📌 [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

In the Flappy Bird game, the player guides a bird through the sky avoiding a series of obstacles. When the bird collides with an obstacle, the game is over. This type of project has proven to be highly interactive and fun in the Scratch classes I’ve taught here at CodeWizardsHQ. In the Elementary School Core Track, students learn how to build their own interactive games while mastering important programming concepts such as variables, loops, and more.

It’s amazing to see how much kids enjoy this type of project and how much they learn along the way.

Complete this Scratch tutorial for kids to build a Flappy Bird game.

completed flappy bird scratch game

Play and remix the Flappy Bird game now. Avoid the obstacles to increase your score.

What you need:

  1. Scratch account: Create a free Scratch account

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

Video Tutorial: How to Make Flappy Bird in Scratch

How to Make Flappy Bird on Scratch

  1. Login to Scratch
  2. Create a New Project
  3. Name Your New Project
  4. Choose a Backdrop
  5. Choose a Sprite
  6. Resize and position the sprite
  7. Add the first code block
  8. Set the sprite’s starting position
  9. Add gravity to the game
  10. Make gravity slower
  11. Make the bird fly up
  12. Design the Game’s Obstacle
  13. Animate the Obstacle
  14. Randomly Position the Obstacle
  15. End the Game Upon Collision
  16. Test your game!

1. Login to Scratch

Login to scratch to build flappy bird

2. Create a New Project

  • Once you are logged in, click the blue Create button at the top of the page.
create a new scratch project

3. Name Your New Project

  • Give your project a name, for example, “Flappy Bird Game”. 
  • Then delete the Scratch cat by clicking the trash can icon next to the sprite.
How to Make Flappy Bird on Scratch Name your project

4. Choose a Backdrop

  • Select the Choose a Backdrop option at the bottom right-hand side of your screen.
choose a backdrop
  • When the Choose a Backdrop screen opens up, select a background for your Flappy Bird game. In this tutorial, I chose “Jungle”, but you can choose whatever you’d like!
Choose a backdrop

5. Choose a Sprite

  • Then, go to the Choose a Sprite option, which is next to the “Choose a Backdrop” section.
Choose a sprite
  • Select a bird sprite of your choosing. We selected the Parrot sprite, which is suggested if you want to create a flapping motion for the character.
select parrot sprite

6. Resize and Position the Sprite

  • Resize your sprite by changing the Size textbox, we changed it to 50 in this tutorial. 
  • Then, click and drag the sprite shown to the left of the game, since the pipes will be moving from the right to the left.
How to Make Flappy Bird on Scratch resize and position scratch sprite

7. Add the first code block

  • Go to the Events category, then click and drag a when green flag clicked events block into your code area.
Add when green flag clicked

8. Set the sprite’s starting position

  • Go to the Motion category and drag a go to x and y block under your when green flag clicked block. This will make sure the player begins at the same place every time the game is loaded.
How to Make Flappy Bird on Scratch Set sprite position

9. Add gravity to the game

  • Then, in the Control block category, drag a forever block and attach it under the go to x and y block.
Add gravity to game
  • Go back up to the Motion category and get a change by y motion block, then drag it directly into the forever block. 
  • Change the value in the textbox of the change by y block to -15. Now when you press the green flag icon above your game, the bird will drop really fast!
Add change position block

10. Make gravity slower

  • To fix the bird from falling so quickly, put a wait block from the Control category before the change y by block. 
  • Change the value in the textbox to about 0.1.
Slow down gravity

11. Make the bird fly up

  • Now let’s make it so the player can interact with the game! Grab a when space key pressed block from the Events category and drag it into the code area.
How to Make Flappy Bird on Scratch When space key pressed block
  • Go to the Motion category and get a change y by block and put it below the when space key pressed block. Now the player can make the bird fly up! NOTE: Check out the bonus after this tutorial which will show you how to make the bird’s wings flap as they fly.
Motion block

12. Design the Game’s Obstacle

  • Click on the paint option from the New Sprite button to create a pipe sprite.
scratch game obstacle
  • Select a color of your choice from the Fill option, then select the square from the list of tools.
Draw obstacles
  • Click and drag the square to create two pillars or tubes that will be obstacles for the game. Reposition and resize the pipes as needed.
draw obstacles

13. Animate the Obstacle

  • Click on the Code tab and drag a when green flag clicked block from the Events category into the code area. Attach a forever block from the Control category.
How to Make Flappy Bird on Scratch animate scratch obstacle
  • Next, go the the Motion category and drag a set y to block, set x to block, and a glide to x and y block inside the forever block. 
  • In the set x to block, change the textbox to say 275. This makes it so the pipes will start on the right side of the screen!
animate scratch motion block
  • Update the glide block to glide for 2 seconds and change the x value to -275, so that it moves to the left of the screen. 
  • Then, in the Motion category, drag a y position block inside of the y value in the glide block.
glide block

14. Randomly Position the Obstacle

  • Test your project, you’ll notice that the pipes stay at the same position every time they move toward the player. 
  • To fix this, go to the Operators category and grab a pick random block and drag it into the set y to block. 
  • Change its values to something like -65 and 65.
position obstacles in scratch

15. End the Game Upon Collision

  • Nothing happens when the parrot collides with the pipe! Let’s get a when green flag clicked block from the Events category and a forever block from the Control category to set this up.
How to Make Flappy Bird on Scratch game collision in scratch
  • From the Control category, get an if then block and put it inside the forever block.
game collision in scratch
  • Then, go to the sensing category and get a touching mouse-pointer block. Drag that into the if then block. 
  • Click the mouse-pointer option to change it to Parrot instead
if then block
  • Go to the Control category and get a stop all block and put that inside the if then block. This will stop the game when the Parrot and pipes collide!
if then block

16. Test your game!

  • The game should stop when the bird collides with the pipes. Check out the completed project here.
completed flappy bird scratch game


Bonus 1 – Adds a points system

1. Create a variable

  • In your Flappy Bird Project, go to the Variables category and right-click on the variable called my variable. It’s right below the Make a Variable button.
  • Then, select the Rename Variable option.
bonus 1 step 1 flappy bird



2. Name the variable

  • In the popup window, type score for the name, then click OK.
bonus 1 step 2 flappy bird

3. Display the Score

  • Then, click the checkbox next to the score variable. This makes the score show up in your game.
bonus 1 step 3 flappy bird

4. Update the score

  • Then, in the Variables category, drag a set score to 0 block right under the when green flag clicked block. 
  • Also get a change score by 1 block and put it under the glide block.
bonus 1 step 4 flappy bird

5. Test the game!

  • Test your game, you should be able to get a score now when you play the game

Bonus 2 – Make the bird’s wings move as you play the game

1. Select the Sprite

  • First, make sure you click the Parrot sprite from the sprites list.
bonus 2 step 1 flappy bird

2. Switch the Sprite’s costume

  • Go to the Looks category and grab a switch costume block for inside the forever block and under the when space key pressed block. 
  • Make sure that you are using parrot-a in the forever block and parrot-b under the when space key pressed block.
bonus 2 step 2 flappy bird

3. Test the Game

  • Do your Parrot’s wings flap? Then, your project is complete, great job!
bonus 2 step3 flappy bird

What is Scratch coding?

Scratch is a block coding language that helps kids learn about computer science. It runs on it’s own web-based platform and is free for anyone to use. It works by taking snippets of code and grouping them into colorful blocks. The blocks can be snapped together to form longer, more complex codes. The more blocks that you use, the more complex the code becomes creating exciting games and apps. It is often used as an educational platform and we highly recommend it for kids ages 8-10 because it doesn’t require strong typing skills. This is a fun and safe coding sandbox for kids to learn fundamental coding concepts and develop their problem-solving and computational thinking. Find out more about Scratch coding for kids.

More Scratch Tutorials & Games

Now that you’ve built your Flappy Bird Game in Scratch, check out these other fun Scratch game tutorials!

  • Flying Space Cat – Assist Space Cat in its space exploration mission by developing an enjoyable crystal-collecting game using Scratch programming platform.
  • Code a Rocket Landing Game – Finish this Scratch programming tutorial designed for children and build a game where you safely land a rocket.
  • Valentines Day Card Scratcher – Create a Valentine’s Day scratch-off card with a personal touch by following this easy-to-follow Scratch programming tutorial.
  • Holidays Advent Calendar – Use Scratch to program a customized Advent Calendar for the holiday season and gradually unveil presents, treats, or activities to share with your friends and family.
  • Halloween Candy Collector Game – Follow this simple Scratch programming tutorial and create a personalized game where you collect candies on Halloween.

Download Free Printable Scratch Coding Tutorials PDF

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

Try a Scratch Coding Class for Kids

At CodeWizardsHQ, we believe that learning about technology and programming at a young age can help you succeed in the future. Our coding program for kids in elementary school uses Scratch to teach them how to code.

In the first course, Animation and Games with Scratch, students learn important programming concepts like variables, loops, and conditionals. By the end of the course, kids will be able to make their own Scratch games and animations. This helps them get ready for more advanced coding and a future in technology. Enroll your child in our top-rated coding classes today.

Coding games in Scratch lets kids learn a useful skill while having fun and discovering something new!

The post How to Make Flappy Bird on Scratch appeared first on CodeWizardsHQ.

]]>