🎮 VizAI Ebook · Volume 1

Build a Whack-a-Mole Game
with AI & Scratch

A step-by-step guide for kids (and curious adults!) to create a fun game using VizAI — no coding experience needed.

⏱ About 60 minutes 🧒 Ages 8 and up 🆓 Free to start 🟡 Works with Scratch 3
Introduction

What You'll Build 🦔

In this ebook, you'll create a complete Whack-a-Mole game in Scratch — with a mole that pops up randomly, a score counter, a 30-second timer, and a Game Over screen. The secret? You don't have to write a single block yourself. We'll use VizAI to do it for us!

What is VizAI?

VizAI (vizai.dev) is an AI tool that turns plain English descriptions into ready-to-use Scratch code blocks. You describe what you want, and VizAI generates the blocks — then you download and drop them straight into Scratch.

How This Ebook Works

Each chapter focuses on one game feature. We'll give you a prompt to type into VizAI, show you what the blocks look like, and explain what each block does. By the end, you'll have a fully working game — and you'll know how to use AI to tackle any Scratch project!

💡

Tip for parents & teachers: Each chapter takes about 5–10 minutes. You can do them all in one sitting or spread them across multiple sessions — Scratch saves your progress automatically.

What You'll Need

· · ·
Chapter 1

Get Ready: Plan Your Game 🗺️

Before we ask VizAI for any blocks, let's think about what our game needs. Great games start with a simple plan!

What Does a Whack-a-Mole Game Need?

Let's break the game into its main parts:

Our Plan: One Feature = One VizAI Prompt

Instead of asking VizAI to build everything at once, we'll ask for one feature at a time. This way, we can check each part works before moving on — just like real game developers do!

✏️

Draw your game on paper first! Sketch the stage with some holes, a mole, a score display, and a timer. It doesn't have to be perfect — just get your ideas down.

How to Use VizAI

🚀 Ready? Let's go!

Open VizAI and Scratch in two browser tabs. We'll switch between them as we build each feature.

· · ·
Chapter 2

Make the Mole Pop Up! 🦔

Time to bring our mole to life. We want it to appear in a random spot, wait for a moment, then hide — over and over again until the game ends.

Step 1 — Type This Prompt into VizAI

🤖 VizAI Prompt
"Create a Scratch sprite that loops forever: randomly move to one of 6 positions on stage, show for 1 second, then hide for a random time between 0.5 and 1.5 seconds. Stop when it receives a 'game over' broadcast."
👆 Copy this exactly and paste it into VizAI

Step 2 — Download and Import

After VizAI generates the blocks, download the .sprite3 file. In Scratch, right-click the Sprites panel (bottom right) → Upload Sprite → select your file.

♻️

AI results may vary! Each time you generate blocks in VizAI, the output might look slightly different. That's completely normal — AI is creative, just like you! If the blocks don't look right or the game doesn't behave as expected, simply click Generate again to get a new version, or fix the blocks manually in Scratch. Learning to spot and fix small errors is one of the most valuable coding skills you can build.

Step 3 — What Do the Blocks Do?

Scratch blocks: mole appear and hide loop

VizAI generated two block stacks — here's what each one does:

Left stack — the main loop

Right stack — the game over listener

🔧 One Small Fix!

Notice the right block says when I receive message1. VizAI used a default name, but we need it to match the broadcast our Timer will send in Chapter 4.

Fix it now: Click the dropdown on that block and rename message1 to game over. This way, when the timer finishes and broadcasts "game over", the mole will know to stop immediately. ✅

💡 This is exactly how real developers work — AI gives you a great starting point, and you refine the details to make everything fit together perfectly.

🎨

Use the Scratch costume editor to draw or upload your own mole sprite! You can find free mole images by searching "mole cartoon" in Scratch's built-in library too.

✅ Test It!

Press the green flag. Does the mole keep jumping to random spots, appearing and hiding? If yes — great work! Move on to Chapter 3 to make it react when you click it.

· · ·
Chapter 3

Click the Mole, Get Points! 🏆

Now let's make clicking the mole actually do something — add a point and play a sound! This time we'll use VizAI's Add More Features button to build on top of what we already made.

Step 1 — Use "Add More Features" in VizAI

Go back to VizAI. You'll see your Chapter 2 blocks are still shown in the Generated Blocks area. Instead of starting over, type your new prompt in the box and click Add More Features — VizAI will add the new blocks on top of the existing ones in the same download!

VizAI Add More Features interface
🤖 VizAI Prompt — Add More Features
"When this sprite is clicked: play a pop sound, add 1 to a variable called Score, and immediately hide the sprite."
👆 Type this, then click Add More Features — not Generate!

Step 2 — Download and Import into Scratch

Download the updated .sprite3 file. In Scratch, right-click your existing mole sprite and choose Delete, then upload the new file — it already contains all the blocks from Chapter 2 plus the new scoring blocks. Everything in one sprite!

Step 3 — What's New in the Blocks?

Scratch blocks: click to score

VizAI added a brand new block stack on the right side:

This is the power of "Add More Features"! Instead of rebuilding everything from scratch, VizAI keeps your previous work and just adds what you asked for. As your game grows, you can keep layering on new features — one idea at a time.

Step 4 — Add the Pop Sound in Scratch

The blocks say start sound pop, but Scratch needs the actual sound file loaded first. Here's how to add it:

Scratch Sounds tab Scratch sound library search for pop

Step 5 — Show the Score on Screen

VizAI created the Score variable automatically, but you need to make sure it's visible on the stage during the game. Here's how to check:

💡

You can right-click the score display on the stage and choose "large readout" to make the number bigger and easier to see while playing!

✅ Test It!

Press the green flag, wait for the mole to appear, then click it. Does the score go up by 1? Do you hear a pop sound? Is the score visible on screen? If all three work — you're halfway to a complete game!

· · ·
Chapter 4

Add a 30-Second Countdown ⏱️

The last piece of our game! We'll create a countdown timer that starts at 30 and automatically stops the game when it hits zero.

Step 1 — Start a New Topic in VizAI

The timer is a completely separate sprite from the mole. Click New Topic in VizAI to start fresh, then paste the prompt below and click Generate.

🤖 VizAI Prompt
"Create a Scratch sprite that: sets a variable called Timer to 30, then counts down by 1 every second. When Timer reaches 0, broadcast 'game over' and stop."
👆 Use Generate (not Add More Features) — this is a brand new sprite

Step 2 — Import as a New Sprite

Download the .sprite3 file and import it into Scratch. You'll see a new sprite appear in the Sprites panel alongside your mole. This sprite acts as the game's invisible clock.

Step 3 — What Do the Blocks Do?

Scratch blocks: countdown timer
📡

What is a broadcast? Think of it like a school bell — when it rings, everyone stops what they're doing. When the timer broadcasts "game over", every sprite that is listening for that message will react.

Step 4 — Hide the Timer Sprite

When you import the timer sprite, you'll notice it appears as a character on the stage. Since it's just a clock, we don't need to see it! There are two easy ways to hide it:

Step 5 — Show the Timer on Screen

Just like Score, make sure the Timer variable is ticked in the Variables category so the countdown is visible on the stage during the game.

Your Completed Game 🎉

That's it — your Whack-a-Mole game is done! Here's what the finished project looks like in Scratch:

Completed Whack-a-Mole game in Scratch
✅ Final Test!

Press the green flag and play! Does the mole pop up randomly? Does your score go up when you click it? Does the timer count down from 30 and stop the game at zero? If yes — congratulations, you just built your first AI-powered Scratch game! 🏆

Ready to Build Your Next Game? 🎮

You built a complete game using just 3 VizAI prompts. Imagine what you can create next!

Try VizAI Free →
Quick Reference

All 3 VizAI Prompts 📋

Save these prompts — or share them with a friend who wants to build the same game!

Chapter 2 — Mole Appears

"Create a Scratch sprite that loops forever: randomly move to one of 6 positions on stage, show for 1 second, then hide for a random time between 0.5 and 1.5 seconds. Stop when it receives a 'game over' broadcast."

Chapter 3 — Click to Score (use Add More Features)

"When this sprite is clicked: play a pop sound, add 1 to a variable called Score, and immediately hide the sprite."

Chapter 4 — Countdown Timer (new sprite — use Generate)

"Create a Scratch sprite that: sets a variable called Timer to 30, then counts down by 1 every second. When Timer reaches 0, broadcast 'game over' and stop."
💡

Remember: AI results may vary each time you generate. If the blocks don't look right, try generating again or fix the details manually in Scratch — that's part of the learning!