Odd Even Quiz Game in Scratch for Kids: Step-by-Step Tutorial
Scratch Game
Odd Even Quiz Game in Scratch for Kids: Step-by-Step Tutorial
Are you eager to dive into Scratch coding and create a truly interactive math game that teaches core programming concepts while reinforcing basic arithmetic? You've come to the right place! In this Odd Even Quiz Game in Scratch, we'll build an engaging Odd & Even numbers quiz—a classic Scratch math quiz game that's perfect for beginners and educators alike.
You'll guide your players through random number challenges, where they'll click Odd, Even, and Next buttons to respond and progress. Along the way, you'll learn how to use random numbers in Scratch, operate with variables, implement decision logic, manage sprites and costumes, and create interactive feedback—all foundational elements of logic-building game design.
By the end, you'll not only have a polished Quiz Game in Scratch to share with friends and students but also a deeper understanding of Scratch programming essentials.
What You'll Learn in This Scratch Math Quiz Tutorial
- Reinforces Math Concepts - Players practice recognizing odd/even numbers on the fly—a great tool for reinforcing number sense.
- Teaches Core Programming Logic - You'll use if-else logic, operators like mod, and Boolean conditions—all key constructs in any programming language.
- Engages with Interactive Design - Beautifully designed sprites, dynamic score updating, and key user feedback create a polished gameplay experience.
- Builds Confidence in Scratch Development - Through this Scratch project step-by-step, you'll navigate sprite setup, variable management, control blocks, and event sequencing—all while keeping students motivated.
- Scalable and Fun - Want to add levels, timers, or sound effects later? This structure makes it easy to expand into a full-fledged logic game or interactive game in Scratch.
Step-by-Step: Build Interactive Scratch Odd Even Quiz Game
1. Scratch Math Quiz Setup: Add Backdrop, Host & Buttons
1.1 Remove the Cat & Choose a Backdrop
- Open Scratch
- Delete the default cat sprite by right-clicking and selecting delete.
- Click Choose a Backdrop, search for "light," and select a simple, bright backdrop. This style keeps the interface clean and focused.
1.2 Add the Quiz Host: "Shasha"
- Click Choose a Sprite → Search for "Shasha".
- Add your favorite pose, then open Costumes and pick the happier version for your game host.
1.3 Create Three Button Sprites
- Click Add Sprite, search "button," and add one.
- Duplicate it twice so you have three buttons.
- Rename them in the Sprite List as:
- Odd
- Even
- Next
- Customize each:
- Odd → orange background, white border, white text
- Even → green background, white text
- Next → blue background, white text
- Select uniform color styles and shades to indicate interactivity.
These steps make your UI intuitive—students know exactly where to click and what each button does.
2. Scratch Variables Tutorial: Create Number, Score & Click Button
Create Essential Scratch Variables
Go to Variables and create three variables:
number– Stores the random integer to evaluate. Set as visible and large for readability.score– Tracks correct answers. Visible.click button– A hidden variable managing button-state logic (0 or 1).
Configuring Scratch Variables
- Set
numberto display in the center of the screen in large style. - Place
scoreprominently at the top corner. click buttonremains hidden—used only for internal logic.
Initialization on Start
In Shasha's script:
when green flag clicked
hide [number v]
set [score v] to [0]
set [click button v] to [0]
This ensures a fresh start each time the game runs.
3. Scratch Host Coding: Greeting & Random Number Generator
Shasha guides the player and introduces each round.
Greeting Sequence
when green flag clicked
say [Hello, my friend.] for 2 secs
wait 1 sec
say [Tell me if this number is odd or even. Press the right button.] for 3 secs
Reveal Random Number
show variable [number v]
set [number v] to (pick random [1] to [100000])
This code sequence ensures Shasha greets players first, then displays the challenge.
4. Button in Scratch: Odd & Even with Mod Operator
a. "Odd" Button in Scratch
when this sprite clicked
if <(click button = 0) and ((number mod 2) = 1)> then
change [score v] by [1]
say [Wow! You are correct!] for 2 secs
set [click button v] to [1]
else
say [Sorry, you are wrong. This is an even number.] for 2 secs
end
b. "Even" Button in Script
when this sprite clicked
if <(click button = 0) and ((number mod 2) = 0)> then
change [score v] by [1]
say [Wow! You are correct!] for 2 secs
set [click button v] to [1]
else
say [Sorry, you are wrong. This is an odd number.] for 2 secs
end
Why this works:
(number mod 2)checks the remainder:0= even1= odd
- The
click buttonvariable prevents repeated clicks on the same round.
5. Scratch Next Button Tutorial: Flow Control & Round Reset
Controls progression to the next round.
when this sprite clicked
if <(click button) = 1> then
set [click button v] to [0]
hide variable [number v]
wait [1] secs
show variable [number v]
set [number v] to (pick random [1] to [100000])
else
say [Please give the answer to the current question, then press 'Next'.] for 2 secs
end
This button resets after an answer and ensures pacing and order in gameplay.
6. Putting It All Together
Game Flow Recap
- Click green flag → reset variables and reset the board.
- Shasha greets the player, prompt appears.
numbervariable is displayed and a random number appears.- Player clicks Odd or Even:
- Correct → score +1, feedback,
click button= 1 - Incorrect → feedback,
click button= 1
- Correct → score +1, feedback,
- Player clicks Next:
- Moves on if
click button= 1 - Shows error if
click button= 0
- Moves on if
This full sequence forms a tight Scratch number guessing game.
7. Testing Tutorial: Debug Scratch Odd Even Quiz Game
Test several scenarios to ensure the logic is solid:
- Clicking Next before answering should prompt you to answer first.
- Score shouldn't increase for wrong answers.
- Button state resets each round.
If something's broken, add a test line like:
say [DEBUG: click button = (click button)] for 2 secs
Use this to verify internal state quickly.
8. Scratch Enhancements Tutorial: Add Levels, Timer, Sounds & Multiplayer
Explore possibilities to elevate your project:
- Difficulty Levels - Offer range options (1–20, 1–1000, 1–1,000,000) with choices upfront.
- Countdown Timer - Add a
timervariable and countdown sequence for urgency. - High Score Tracking - Use cloud variables for cross-session memory.
- Visual & Audio Feedback - Add sound effects for correct/wrong answers and sprite animations like confetti.
- Multiplayer Mode - Two-player alternating turns with alternating score counters.
- Broadcast Events - Convert green flag sequences into broadcasts like
startandnext question. - Accessibility - Larger fonts, clear color contrast, and engaging colors for younger learners.
Watch the Full Video Tutorial
🎬 Watch the complete Odd Even Quiz Game tutorial on YouTube – Scratch Odd Even Quiz Game to Identify Odd and Even Numbers | Kids Coding Project
This video tutorial demonstrates every step visually.
Scratch Odd Even Quiz Game: Summary of Steps
Build an Interactive Odd & Even Quiz Game in Scratch: A Step-by-Step Tutorial
Step-by-step tutorial for Scratch Math Quiz: Setup backdrop/sprites/buttons, create variables, code host/greeting/random numbers, button logic with mod/if-else, Next flow, test/debug, and enhancements like difficulty/timer/sounds/cloud scores/multiplayer.
Total Time: 50 minutes
Scratch Quiz Setup: Backdrop, Sprites & Buttons
Open Scratch, delete default cat, add light backdrop, Shasha host (happy costume), and three buttons (Odd orange, Even green, Next blue with text).
Scratch Variables Tutorial: Number, Score & Click Button
Create visible 'number' (center/large) and 'score' (top); hidden 'click button' (0/1 state). Initialize on green flag.
Scratch Host Coding: Greeting & Random Number Display
Shasha greets, displays random number.
Scratch Button Logic Tutorial: Odd & Even with Mod Operator
Odd: If (number mod 2 = 1), score +1/feedback; set click button =1. Even: If (number mod 2 = 0).
Scratch Next Button Tutorial: Flow Control & Round Reset
Next only if click button =1; reset to 0, new random number.
Scratch Testing Tutorial: Debug Game Flow & Edge Cases
Green flag to start; test clicks, score, mod logic; debug with say blocks.
Scratch Enhancements Tutorial: Levels, Timer, Sounds & Multiplayer
Add difficulty (number range), countdown timer, sounds (cheer/pop), cloud high scores, multiplayer turns.
Scratch Quiz FAQ Tutorial: Common Questions & Remix Tips
Address mod operator, button states, random generation; remix with images/levels.
Conclusion
Congratulations—you've built an interactive, logic-driven Odd Even Quiz Game in Scratch from scratch! You learned to:
- Create sprites and customize costumes
- Manage variables and UI state
- Use
modlogic for odd/even detection - Handle event-driven sprites and interactive buttons
- Prevent invalid input with flow control using
click button - Provide dynamic feedback and progression
By watching the video and referencing this detailed blog, you now have both the why and how to build logic games with Scratch. Keep experimenting—add timers, layer in sound, or introduce multiplayer to expand your skills!
FAQ: Frequently Asked Questions – Scratch Odd Even Quiz Game
| Question | Answer |
|---|---|
| How does the mod operator work in Scratch to check odd/even? | The mod operator (remainder) divides a number and returns what's left over. number mod 2 = 0 → even number mod 2 = 1 → odd This is the fastest and cleanest way in Scratch – no complicated math needed! |
| Why do we need the hidden "click button" variable? | It stops kids from clicking the Next button too early or clicking Odd/Even twice in the same round. It acts like a "lock" that only unlocks after they make a choice. |
| My score isn't increasing – what's wrong? | Common fixes: 1. Make sure the score variable is shown (checkbox ticked) 2. Check that the Odd/Even button sets click button to 1 only after the if-else block 3. Use "change [score v] by (1)" inside the correct condition |
| How to add sound effects (cheer for correct, buzzer for wrong)? | Import "cheer" and "buzzer" from the Scratch library. Correct → play sound [cheer v] until done Wrong → play sound [buzzer v] until done |
| Can I turn this into a two-player game? | Yes! Add a "player" variable: * Player 1 answers → if correct, +1 to [player1 score v] * Switch turns with change [player v] by (1) and if <(player mod 2) = 1> logic |
| How do I save the high score forever (cloud leaderboard)? | Turn on cloud variables (needs "Scratcher" status): when green flag clicked if <(score) > (☁ high score)> then set [☁ high score v] to (score) end |
| My buttons are too small on tablets – how to fix? | Resize buttons to 150–200% and use big bold text. Works perfectly on iPads and Chromebooks! |
| What age is this project best for? | Ages 6–12: • 6–8 year olds: Learn odd/even basics • 9–12 year olds: Add levels, timer, cloud scores, multiplayer |
If you loved this Scratch project,
- Don't forget to check out the full video tutorial by Kodex Academy here: Scratch Odd Even Quiz Game to Identify Odd and Even Numbers | Kids Coding Project by Omaansh Aggarwal
- Like, comment & share the video
- Visit kodexacademy.com
- Subscribe to the Kodex Academy YouTube channel for deeper Scratch content.
Happy coding with Kodex Academy! 🚀