How to Make a Shadow Milk Scratch Game: Step-by-Step Beginner Guide

Reading Time: 11 mins

Turn screen time into skill time! Ready to create your very own Shadow Milk Scratch game? This beginner-friendly tutorial walks you through every step of building an interactive game where a shadowy character follows the player around. Perfect for kids learning to code and anyone new to Scratch programming.


What Is Shadow Milk Scratch Game?

Shadow Milk Scratch game is a fun coding project where you control a character (Milk) that moves around different rooms while a mysterious shadow follows every move. It’s a great way to learn key programming concepts like sprite movement, cloning, and game states.

What You’ll Learn:

  • Character movement and animation
  • Shadow following mechanics
  • Room switching logic
  • Music controls and UI buttons
  • Game reset functionality

Skill Level: Beginner to Intermediate
Recommended Age: 8+ years
Time Required: 30-45 minutes


Prerequisites: What You Need to Get Started

Before diving into this shadow milk scratch game tutorial, make sure you have:

  • A Scratch account (free at scratch.mit.edu)
  • Basic Scratch knowledge (how to add sprites and backdrops)
  • 30-45 minutes of focused time
  • The project assets (sprites and backdrops provided in the tutorial)

Step 1: Create Your Scratch Project and Save It

How to set up your project:

  1. Go to scratch.mit.edu
  2. Click β€œCreate” to start a new project
  3. Navigate to File > Save now
  4. Name your project β€œShadow Milk Game”

Pro Tip: Save your work frequently as you progress through this shadow milk scratch game guide for beginners. Use File > Save now after completing each major section.


Step 2: Setting Up Sprites and Backdrops

Adding Your Game Sprites

Your shadow milk scratch game needs three main sprites:

  1. Stupid Milk (the player character)
  2. Cursor (for mouse interaction)
  3. Furniture (interactive objects)

How to add sprites:

  1. Click the Choose a Sprite button (cat icon in bottom right)
  2. Upload or draw your custom sprites
  3. Name each sprite clearly for easy reference

Creating Game Backdrops

Your game needs two rooms:

Main Room Backdrop:

  • Click the Choose a Backdrop button
  • Use the paint editor to create a simple room
  • Colors: Purple/blue gradient (#8B7DC3 to #6B92B5)
  • Add basic floor and wall divisions

Bedroom Backdrop:

  • Duplicate the main backdrop
  • Adjust colors to create variety
  • Keep a consistent floor/wall layout

Design Tip: Keep your backgrounds simple and uncluttered. This helps players focus on the character movement and shadow mechanics.


Step 3: Creating Essential Variables and Lists

Variables and lists are the backbone of how to code shadow milk scratch game logic.

Variables for All Sprites

Create these variables (available to all sprites):

  1. game state – Controls if the game is playing, paused, or stopped
  2. mute music – Toggles background music on/off

How to create variables:

  1. Click Variables category
  2. Select Make a Variable
  3. Name it exactly as shown
  4. Choose β€œFor all sprites”
  5. Repeat for each variable

Lists for the Milk Sprite

Switch to your Milk sprite and create these lists:

  1. id info – Stores object identification data
  2. sound info – Manages sound effects

What are lists? Lists store multiple pieces of information in one place, like a shopping list holds multiple items. They’re essential for managing multiple objects in your game.


Step 4: Stage Code – The Game Controller

The Stage acts as your game’s central controller, managing room changes and music.

Creating Broadcast Messages

Broadcast messages let different sprites communicate. Create these messages:

  1. init game – Starts the game
  2. switch to bedroom – Changes to bedroom scene
  3. enter bedroom – Positions sprites in bedroom
  4. enter main room – Returns to main room
  5. switch to main – Switches backdrop to main
  6. start controls – Enables player movement
  7. reset game – Restarts everything
  8. update music controls – Updates music button

How broadcast messages work: Think of them like walkie-talkies. When the Stage broadcasts β€œenter bedroom,” all sprites listening for that message will respond.

Main Game Loop Code

Add this code to the Stage:

When green flag clicked:

When green flag clicked
└─ broadcast [init game]

When init game received:

When I receive [init game]
β”œβ”€ switch backdrop to [main]
β”œβ”€ set [game state] to [play]
β”œβ”€ set [mute music] to [0]
└─ broadcast [enter main room]

Room switching receivers:

When I receive [switch to bedroom]
β”œβ”€ switch backdrop to [bedroom]
└─ broadcast [enter bedroom]

When I receive [switch to main]
β”œβ”€ switch backdrop to [main]
└─ broadcast [enter main room]

Step 5: Milk Movement – Player Controls

Now let’s make your character move! This is where your shadow milk scratch game for kids really comes alive.

Creating the Handle Movement Custom Block

Custom blocks help organize your code and make it reusable.

How to create the custom block:

  1. Click My Blocks category
  2. Select Make a Block
  3. Name it β€œhandle movement”
  4. Click OK

Initial Positioning Code

Add this code to the Milk sprite:

When init game received:

When I receive [init game]
β”œβ”€ go to x: (0) y: (0)
└─ show

When green flag clicked:

When green flag clicked
β”œβ”€ hide
β”œβ”€ go to x: (0) y: (0)
└─ set [walk anim] to [0]

Room entry positioning:

When I receive [enter bedroom]
└─ go to x: (-100) y: (-50)

When I receive [enter main room]
└─ go to x: (0) y: (0)

Movement Control Logic

This is the heart of how to play shadow milk scratch game – the arrow key controls!

Continuous movement loop:

When [space] key pressed
β”œβ”€ broadcast [start controls]
└─ forever
    └─ if <[game state] = [play]> then
        └─ handle movement

Define handle movement block:

define handle movement
β”œβ”€ if <key [right arrow] pressed?> then
β”‚  β”œβ”€ change x by (4)
β”‚  β”œβ”€ point in direction (90)
β”‚  └─ change [walk anim] by (1)
β”‚
β”œβ”€ if <key [up arrow] pressed?> then
β”‚  β”œβ”€ change y by (4)
β”‚  β”œβ”€ point in direction (90)
β”‚  └─ change [walk anim] by (1)
β”‚
β”œβ”€ if <key [down arrow] pressed?> then
β”‚  β”œβ”€ change y by (-4)
β”‚  β”œβ”€ point in direction (90)
β”‚  └─ change [walk anim] by (1)
β”‚
└─ if <key [left arrow] pressed?> then
   β”œβ”€ change x by (-4)
   β”œβ”€ point in direction (90)
   └─ change [walk anim] by (1)

How movement works: Each arrow key changes the character’s position by 4 pixels and updates the walk animation counter. The direction is set to 90 degrees (facing right) for visual consistency.

Simple Walk Animation

Add animation by cycling through costumes:

if <[walk anim] > [5]> then
β”œβ”€ set [walk anim] to [0]
└─ next costume

Animation tip: The walk animation counter increases as you move. When it exceeds 5, it resets and switches to the next costume, creating a walking effect.


Step 6: Shadow Follows Milk – The Cool Effect!

Here’s where the magic happens – creating a shadow that mimics your every move!

Creating the Shadow Sprite

How to duplicate the Milk sprite:

  1. Right-click on the Milk sprite
  2. Select β€œduplicate”
  3. Rename it to β€œshadow”

Making the Shadow Dark

Adjust shadow appearance:

  1. Select the shadow sprite
  2. Click the β€œCostumes” tab
  3. Use the fill tool to recolor it black
  4. Set these graphic effects:
    • Color: 0 (pure black/gray)
    • Saturation: 100
    • Brightness: 0 (darkest)

Visual effect: This creates that eerie, shadowy appearance that makes your game mysterious and engaging.

Shadow Following Code

Add this code to the shadow sprite:

When green flag clicked:

When green flag clicked
β”œβ”€ hide
└─ forever
    └─ if <[game state] = [play]> then
       β”œβ”€ show
       β”œβ”€ go to [stupid milk]
       β”œβ”€ go back (1) layers
       β”œβ”€ set [ghost] effect to (50)
       └─ set [brightness] effect to (-100)
    else
       └─ hide

How the shadow works: The shadow constantly moves to the Milk sprite’s position but stays one layer behind. The ghost effect (50%) makes it semi-transparent, and the brightness effect (-100) keeps it dark.

Troubleshooting tip: If your shadow appears in front of the player, adjust the β€œgo back” layer value or ensure the shadow sprite is below the Milk sprite in the sprite list.


Step 7: Furniture and Room Transitions

Interactive objects make your game world feel alive! Let’s add furniture that triggers room changes.

Setting Up Furniture Sprite

Initial furniture code:

When green flag clicked
└─ hide

When I receive [init game]
β”œβ”€ go to [stupid milk]
└─ show

Game state management:

forever
β”œβ”€ if <[game state] = [play]> then
β”‚  β”œβ”€ point towards [stupid milk]
β”‚  └─ move (2) steps
└─ else if <[game state] = [pause]> then
   └─ hide

Interactive Collision Detection

How to trigger room changes:

When this sprite clicked
└─ if <touching [stupid milk]?> then
    └─ broadcast [switch to bedroom]

How this works: When you click furniture AND your character is touching it, the game switches rooms. This creates an intuitive point-and-click adventure feel.

Design variation: You can add multiple furniture pieces with different interactions:

  • Bed β†’ switches to bedroom
  • Door β†’ returns to main room
  • Cabinet β†’ reveals hidden items

Step 8: Spawning Objects with Clones

Clones let you create multiple copies of sprites efficiently – perfect for collectibles or decorative items!

Objects Sprite Clone System

Setting up the cloning loop:

When I receive [enter main room]
└─ repeat (5)
    └─ create clone of [myself]

Individual clone behavior:

When I start as a clone
β”œβ”€ show
β”œβ”€ go to x: (pick random -200 to 200) y: (pick random -120 to 120)
└─ forever
    β”œβ”€ if <[game state] = [play]> then
    β”‚  └─ change y by (1)
    └─ else if <touching [stupid milk]?> then
       β”œβ”€ broadcast [milk interacted]
       └─ delete this clone

What are clones? Think of clones like photocopies – each one is an independent copy that can move and act separately. They’re perfect for creating multiple sparkles, coins, or other collectible items.

Cleanup Code

Prevent sprite pile-up:

When green flag clicked
└─ hide

When I receive [reset sprites]
└─ delete this clone

Why cleanup matters: Without proper cleanup, clones can accumulate and slow down your game. Always delete clones when switching rooms or resetting.


Step 9: UI Elements – Buttons and Controls

User interface elements help players interact with your game beyond just movement.

Mute Music Button

Creating the button sprite:

  1. Create a new sprite named β€œmute music”
  2. Draw two costumes:
    • Costume 1: Music ON icon (speaker with sound waves)
    • Costume 2: Music OFF icon (speaker with X)

Button positioning:

When green flag clicked
β”œβ”€ show
└─ go to x: (210) y: (150)

Toggle functionality:

When this sprite clicked
β”œβ”€ if <[mute music] = [0]> then
β”‚  └─ set [MUTE MUSIC] to [1]
└─ else
   └─ set [MUTE MUSIC] to [0]
└─ broadcast [update music controls]

Visual feedback:

When I receive [update music controls]
β”œβ”€ if <[MUTE MUSIC] = [0]> then
β”‚  └─ switch costume to [music on]
└─ else
   └─ switch costume to [music off]

Stage Music Response

Add this to the Stage:

When I receive [update music controls]
β”œβ”€ if <[MUTE MUSIC] = [0]> then
β”‚  └─ forever
β”‚     └─ if <[MUTE MUSIC] = [1]> then
β”‚        β”œβ”€ stop all sounds
β”‚        └─ stop [this script]
β”‚     └─ else
β”‚        └─ play sound [click2] until done
└─ else
   └─ stop all sounds

User experience tip: Always provide visual feedback when players click buttons. The costume change lets them know their click registered.


Step 10: Cursor Sprite for Custom Pointer

Replace the default mouse cursor with a custom design for a polished look!

Custom Cursor Code

Simple cursor following:

When green flag clicked
└─ forever
    └─ go to x: (mouse x) y: (mouse y)

Optional enhancements:

  • Add clicking animation (costume change on mouse down)
  • Add hover effects when over clickable objects
  • Change cursor appearance in different rooms

Hiding default cursor: In the full game, you’d add a block to hide the default pointer, but Scratch 3.0 requires a browser extension for this feature.


Step 11: Game Reset System

Every good game needs a way to start fresh! Let’s build the reset functionality.

Creating the Reset Custom Block

On the Stage, create this block:

Reset broadcast message:

Stage Reset Logic

Define the reset block:

When this sprite clicked
└─ broadcast [reset game]

Sprite Reset Responses

Milk sprite reset:

When I receive [reset sprites]
β”œβ”€ go to x: (0) y: (0)
β”œβ”€ set [walk anim] to [0]
└─ show

Objects/Effects sprites:

When I receive [reset sprites]
└─ delete this clone

Complete reset sequence: When the player clicks the reset button, all variables return to default values, all clones are deleted, the player returns to the starting position, and the game state resets to β€œplay.”


Common Issues and How to Fix Them

Shadow Milk Scratch Game Not Working Fix

Problem: Shadow appears in front of player

  • Solution: Add go back (1) layers to shadow code after go to [stupid milk]

Problem: Arrow keys don’t move character

  • Solution: Check that game state is set to β€œplay” and press spacebar to start controls

Problem: Room transition doesn’t work

  • Solution: Verify broadcast message names match exactly (case-sensitive)

Problem: Clones don’t disappear when resetting

  • Solution: Ensure all clone sprites have
  • when I receive [reset sprites] β†’ delete this clone

Shadow Milk Scratch Game Tips and Tricks

Performance optimization:

  • Limit active clones to 10-15 maximum
  • Use hide instead of setting ghost effect to 100
  • Delete clones when they move off-screen

Visual improvements:

  • Add subtle animations to furniture
  • Create particle effects when collecting items
  • Design distinct backdrops for each room

Gameplay enhancements:

  • Add a score system using variables
  • Create multiple rooms with different challenges
  • Add sound effects for actions (jumping, collecting, etc.)

Shadow Milk Scratch Game Examples and Variations

Easy Version for Younger Kids

Simplified features:

  • Remove clone system
  • Use only one room
  • Slow down movement speed (change by 2 instead of 4)
  • Add visual guides (arrows showing where to go)

Advanced Challenge Version

Added complexity:

  • Multiple shadow colors that mean different things
  • Puzzle elements requiring specific movement patterns
  • Timer system for speed challenges
  • Collectible items that affect gameplay

What You’ve Learned

Congratulations! You now know how to create shadow milk scratch game from scratch. You’ve mastered:

Core programming concepts:

  • Variables and game states
  • Sprite movement and animation
  • Clone management
  • Broadcast messaging
  • Collision detection

Game design elements:

  • Room transitions
  • UI/UX with buttons
  • Reset functionality
  • Shadow following mechanics

Next steps in your coding journey:


Frequently Asked Questions

How does shadow milk scratch game work?

The shadow milk scratch game uses sprite cloning and positioning logic to create a shadow that continuously moves to the player’s location while staying one layer behind. The game state variable controls whether sprites are active, and broadcast messages coordinate actions across multiple sprites.

What is shadow milk scratch game best used for?

Shadow milk scratch game is perfect for teaching fundamental game development concepts like sprite control, state management, and clone systems. It’s an excellent project for beginners learning Scratch programming and students aged 8-14 exploring game design.

How long does it take to make shadow milk scratch game?

Most beginners can complete the basic shadow milk scratch game in 30-45 minutes following this step-by-step guide. Adding custom features and polish might take an additional 30-60 minutes depending on your creativity and experience level.

Can I customize my shadow milk scratch game?

Absolutely! The best way to make shadow milk scratch game your own is to:

  • Design unique character sprites
  • Create additional rooms with different themes
  • Add scoring and challenge mechanics
  • Customize colors and sound effects
  • Build your own storyline

What are shadow milk scratch game features I can add?

Popular additions include:

  • Inventory systems for collecting items
  • Enemy sprites that chase the player
  • Puzzle locks requiring keys or codes
  • Multiple shadow colors with different behaviors
  • Power-ups that change gameplay

Share Your Creation!

You’ve just learned how to code shadow milk scratch game in Scratch – now it’s time to make it your own! At ItsMyBot, we believe every child can become a confident creator.

Show us what you built:

  • Share your project on Scratch and tag @ItsMyBot
  • Join our online coding courses for more projects
  • Connect with other young creators in our community

Ready for more challenges? Explore our other Scratch tutorials to keep building your coding skills. Remember: every expert coder started exactly where you are now – with curiosity and one project at a time.


About ItsMyBot

We turn screen time into skill time with personalized, industry-level coding courses for kids aged 5-15. Through hands-on projects like this shadow milk scratch game tutorial, children build creativity, confidence, and future-ready skills while parents stay informed every step of the way.

Start Your Coding Journey Today β†’

Project Link: https://scratch.mit.edu/users/GPE_sb3/

Tags

Share

Poornima Sasidharan​

An accomplished Academic Director, seasoned Content Specialist, and passionate STEM enthusiast, I specialize in creating engaging and impactful educational content. With a focus on fostering dynamic learning environments, I cater to both students and educators. My teaching philosophy is grounded in a deep understanding of child psychology, allowing me to craft instructional strategies that align with the latest pedagogical trends.

As a proponent of fun-based learning, I aim to inspire creativity and curiosity in students. My background in Project Management and technical leadership further enhances my ability to lead and execute seamless educational initiatives.

Related posts