Ultimate Scrolling Background & Character Animation | Step-by-Step Scratch Tutorial

Ultimate Scrolling Background & Character Animation Step-by-Step Scratch Tutorial

Introduction: Scrolling Background & Character Animation

Welcome to this in-depth Scratch Scrolling Background & Character Animation tutorial, perfect for kids, beginners, and educators diving into the world of game development with Scratch.

Build Your First Side-Scrolling Game with Scratch – Perfect for Beginners, Kids, and Educators

If you’ve ever dreamed of creating your own video game or interactive animation, Scratch is one of the best places to start. Developed by MIT, Scratch is a visual block-based programming language that makes learning to code fun, creative, and accessible—especially for kids and beginners.

In this comprehensive tutorial, we’ll walk you through one of the most exciting concepts in 2D game development: the scrolling background and character animation effect. This type of animation makes your game environment feel alive and dynamic, just like popular side-scrolling games such as Super Mario Bros. or Sonic the Hedgehog.

But we’re not stopping there!

You’ll also learn how to:

  • Create a walking sprite animation (watch a bear walk smoothly across your screen!)
  • Implement a side-scrolling background using Scratch motion blocks
  • Build a custom backdrop directly inside a sprite (without needing the Backdrops tab!)
  • Duplicate background sprites for seamless infinite scrolling
  • Use forever loops to run animations and movements continuously
  • Manage layering so your characters appear in front of the background
  • Explore core concepts of Scratch game development for beginners

This is more than just a Scratch beginner tutorial—it’s a foundation for building your own fully playable side-scrolling games using block-based logic, creativity, and storytelling.

Start Here: Watch the Full Tutorial on YouTube

Before diving into the steps, check out this beginner-friendly Scratch tutorial on YouTube by Omaansh Aggarwal. It’s a visual walkthrough that complements this blog and will help reinforce key concepts as you build along.

What Are We Building?

By the end of this guide, you’ll have completed a polished Scratch animation that includes:

  • A walking bear sprite
  • A realistic side-scrolling effect
  • A looping background with duplicated sprite backdrops
  • Proper use of Scratch forever loops
  • Introduction to layer control
  • And many beginner-friendly tricks used by real game developers!

Whether you’re just starting out or teaching Scratch to kids in a classroom or workshop, this hands-on project offers a fun and educational way to learn Scratch programming basics.

Plus, with our enhancement features and extra code examples (toward the end of this post), you’ll be able to level-up your project with sound, jump mechanics, parallax scrolling, and more!

Tools You’ll Need

  • Scratch Editor (online at https://scratch.mit.edu or desktop version)
  • Basic familiarity with Scratch blocks
  • An animated sprite with multiple costumes (e.g., bear walking)

Scratch Coding: Scrolling Background & Character Animation

Let’s dive into the Scratch coding for Scrolling Background & Character Animation

Step 1: Setting Up Your Scratch Project – Remove the Default Sprite

Watch it in video: Adding a New Sprite and Resizing It – Adjusting Sprite Size for Better Fit

When you open Scratch (via scratch.mit.edu), you’ll notice that the default cat sprite is already on the stage. For this project, we’re going to use a walking bear sprite instead.

Here’s what to do:

  1. Click on the sprite thumbnail (the cat) in the bottom-right area of the screen.
  2. Press the trash can icon to delete it.
  3. Now, click the “Choose a Sprite” button (the cat icon with a plus sign).
  4. From the sprite library, search for “Bear walking” or any walking sprite you like.

🔍 Tip for kids: Look for a sprite that has multiple costumes. These costumes help us create the walking animation later.

Resize the Sprite:

💡 Tip: If your sprite is too large, resize it using:

By default, the bear might look too large on the stage. To fix that:

  • Click the sprite
  • Go to the “Size” field in the toolbar
  • Set it to 50

This gives your game a polished look and leaves room for background elements.

Step 2: Designing a Custom Scrolling Backdrop in Scratch

Watch it in video: Creating a Custom Backdrop in the Sprite – Choosing Colors and Drawing the Background

Instead of using a regular backdrop, we’re creating the background inside a sprite. Why? Because sprites can move, which means we can scroll them from side to side!

Create a Background Sprite:

  1. Click the “Paint new sprite” button.
  2. Choose the Rectangle Tool from the costume editor.
  3. Select a grayish fill color for the ground (darker tones work best).
  4. Turn the outline width to 0 to avoid black borders.
  5. Draw a long horizontal rectangle to represent the ground.

Add Some Details (Optional but Fun):

  • Use the Circle Tool to draw rocks or bushes.
  • Copy and paste them to scatter across your ground.
  • Vary the size and color to add realism.

🎨 Scratch custom backdrop design helps kids explore artistic skills while reinforcing coding logic. It also opens doors to storytelling.

This sprite becomes our scrolling background. You can name it something like Background1.

Step 3: Coding the Walking Bear Sprite in Scratch

Watch it in video: Animating the Bear: Costume Change Loop

Next, we bring our sprite (the bear) to life by animating its walking motion using costumes and Scratch’s forever loop feature.

Objective:

Make the bear look like it’s walking — not running or sliding!

Code the Animation:

  • Select the bear sprite.
  • Go to the Events category and drag:
  • From Control, drag a:
  • Inside the loop, add these two blocks:
  • From Looks:
  • From Control:

Why the wait 0.1 seconds?

Without the wait block, the sprite will change costumes too quickly and appear to be running instead of walking.

✅ This is a key concept in Scratch animation tutorial workflows.

What This Does:

Each costume frame shows a new walking position. The wait block ensures the switch happens smoothly, simulating realistic walking instead of fast running.

⏱️ Scratch forever loop example shows how loops are essential for continuous animations like walking, flying, or moving scenery.

Step 4: Fixing Sprite Layering in Scratch – Bear Behind or in Front?

Watch it in video: Fixing Sprite Layering in Scratch – Bear Behind or in Front?

If your background is hiding the bear or vice versa, it’s likely due to the layering order in Scratch.

Set the Layer Properly:

  1. Select the bear sprite.
  2. Add the following code under when green flag clicked:

But in this tutorial, since the background is a sprite too, we send the backdrop to the back:

This ensures the walking sprite appears in front of the background.

🎭 Scratch layer control explained: Layers determine which sprite appears on top. Always place characters in front of scenery for visual clarity.

Step 5: Scratch Scrolling Background Tutorial

Watch it in video: Scrolling Code Begins

To create the illusion of motion, we move the background to the left continuously.

Here’s how:

Code for Backdrop Sprite 1

📌 Explanation:

  • The backdrop moves left by 5 units every frame
  • Once it goes off screen (x < -465), it jumps back to the right (x = 460)

Step 6: Scratch Duplicate Sprite Background

Watch it in video: Scratch Duplicate Sprite Background

To make a seamless loop, duplicate the backdrop sprite.

  • Right-click the backdrop sprite → Duplicate
  • Change the initial X position of the second backdrop

Code for Backdrop Sprite 2

Now your game has infinite scrolling!

💡 Pro Tip: Keep backgrounds identical in design to prevent noticeable seams.

a. Scratch Motion Blocks Tutorial

You’ve already used:

  • change x by
  • go to x: y:
  • x position

These are crucial for movement-based logic in any Scratch beginner tutorial.

Read more on Scratch’s official motion block documentation: https://en.scratch-wiki.info/wiki/Motion_Blocks

b. Scratch Forever Loop Example in Action

In this tutorial, both animation and movement use forever loops.

Benefits of forever:

  • Runs continuously without manual triggers
  • Great for background scrolling, animations, and event loops

Bonus Enhancements for Your Game

Here are extra features you can add:

a. Add Parallax Effect (Multiple Scrolling Layers)

Add multiple layers of background sprites moving at different speeds for depth.


b. Add Background Music

Upload a music file and add:

Or for looped sound:

c. Add Jumping Action

Use space key to make the sprite jump:

Make sure to limit how often jumping happens (add checks or cooldowns).

d. Add Start Screen or Menu

Use a broadcast message to transition between a start menu and game:

Conclusion

You’ve just built a complete Scratch scrolling background animation with a walking sprite from scratch! This project covered:

  • Animation logic
  • Scrolling effects
  • Backdrop management
  • Layering and sprite control

Want to expand this project? Add enemies, coins, or levels!

Call to Action

  1. Don’t forget to check out the full video tutorial by Kodex Academy here: Background Scrolling & Character Animation | Moving Sprites (by Omaansh Aggarwal)
  2. Like, comment & share the video
  3. Visit kodexacademy.com
  4. subscribe to the Kodex Academy YouTube channel for deeper Scratch content.

Happy coding with Kodex Academy! 🚀

Learn More with Kodex Academy

At Kodex Academy, we’re passionate about helping students learn coding in creative ways. This project teaches more than Scratch—it empowers young minds to build tools that work in the real world.

Explore more:

Further Reading & Links

Recent Posts

Ultimate Scrolling Background & Character Animation | Step-by-Step Scratch Tutorial

we’ll walk you through one of the most exciting concepts in 2D game development: the scrolling background and character animation effect. This type of animation makes your game environment feel alive...

Scratch Virtual Piano Tutorial: Build Your Own Piano in Scratch (Music Extension)

Learn step-by-step how to build a colorful, interactive virtual piano using Scratch and the Music Extension. By the end of this post, you’ll know how to build a virtual piano Scratch project, create...

Build a Text-to-Speech Translator in Scratch (Supports 45+ Languages!) – Ultimate Guide

Have you ever wanted to build your own multilingual translator that can speak in different languages? With Scratch, you can! In this exciting project, we’ll guide you through building a Text-to-Speech...

Date and Time Virtual Assistance using Text-to-Speech: Create an Alexa-Like Smart Assistant Using Scratch

Do you want to build your own digital assistant in Scratch that can respond to voice commands and share the current date and time? In this comprehensive Scratch virtual assistant tutorial, you’ll...

Mastering Scratch Motion Blocks: A Complete Tutorial for Beginners and Game Developers

One of the most powerful and foundational aspects of Scratch programming is motion blocks—used for controlling sprite movements and building dynamic, interactive projects. Motion blocks are...

Build an Interactive Odd & Even Quiz Game in Scratch: A Step-by-Step Tutorial

In this Scratch quiz game tutorial, we'll build an engaging Odd & Even numbers quiz—a classic math quiz game in Scratch that’s perfect for beginners and educators alike. You’ll guide your players...

Create Amazing Sprite Looks with Looks Blocks: A Complete Guide to Visual Sprite Effects

The “Looks” blocks in Scratch are the secret sauce behind smooth costume changes, exciting visual effects, and immersive game environments. Whether you're just starting your Scratch coding projects or...

Build Your Own Scratch Painting App: A Fun Scratch Coding Tutorial for Kids

In this tutorial, we’ll walk you through creating a painting app in Scratch—a project that combines creativity, problem-solving, and interactive design. Using Scratch’s pen extension, you’ll build an...

Build a Fun “Bouncing Ball” Pong‑Style Game in Scratch – Step-by-Step Guide

Build a Fun "Bouncing Ball" Pong‑Style Game in Scratch - Step-by-Step Guide. This bouncing‑ball game combines fundamental elements: Motion & coordinate control, Sensing sprite overlaps, Variables for...

How to Make a Snowman Chase Snowflakes – Step by step Scratch Game Tutorial

Welcome to this interactive Scratch coding tutorial! If you’ve ever wanted to learn Scratch coding, build fun Scratch projects, and develop a Scratch game idea, there’s no better place to start than a...

Mastering Scratch Pen Blocks Tutorial: Draw Shapes in Scratch with Code

In this post, we'll explore how to use pen blocks in Scratch, demonstrate hands-on Scratch geometry project workshops, and empower you to draw shapes in Scratch using clean, loop-based code. Along...

How to Make a Star Trail Animation in Scratch – Easy Scratch Project Tutorial

In this detailed Scratch tutorial, you'll discover how to combine block programming logic, Scratch coding techniques, and creative flair to create animations in Scratch. By the end, you'll have a...

Build a Simple Calculator in Scratch – Step‑by‑Step Guide!

In this Scratch calculator tutorial, we take you from watching a quick demo to building a functional calculator in Scratch—complete with user prompts, number input, and basic arithmetic operations...

Even or Odd Number Finder – Scratch Game by Kodex Academy

The concept is simple but powerful. The game randomly shows numbers on the screen, and the player must decide whether the number is even or odd. They click the correct button (Even or Odd), and the...

Learn to Code with Eat Yummy Taco – A Fun Scratch Game for Kids

Get ready to dive into a deliciously engaging game that will tickle your taste buds and test your reflexes — all while learning how to code! “Eat Yummy Taco” is a beginner-friendly and fun Scratch...

How to Build an Interactive Hide and Seek Game in Scratch 3.0: A Beginner’s Guide by Kodex Academy

Every good game begins with a scene. In Scratch, this means choosing a backdrop and designing the space where the game happens. This section guides you through selecting or creating a background that...

My Blocks in Scratch Explained | A Complete Guide to Custom Blocks for Beginners (Scratch 3.0)

The My Blocks palette in Scratch is essentially your personal toolset. While the other palettes give you predefined blocks (like motion, looks, or sound), My Blocks allows you to create your own...

Understanding Block Programming: A Fun and Interactive Approach to Coding

One of the best ways to introduce kids to programming is through block programming, a method that simplifies coding concepts using visual blocks instead of writing complicated lines of code...
Scroll to Top