Module Seven: Introduction to Coding with Blocks
Hello, young coder! You have already learned how to think like a game developer. You made plans, drew sprites, and designed levels. Now it is time to bring those ideas to life inside a computer. In this module, you will learn to talk to the computer using colorful blocks. It is like playing with digital Lego. Letâs build something amazing together!
Module Introduction
Do you remember the Game Loop from Module Six? The loop that goes Input, Update, Render? To make that loop actually work on a screen, we need to give the computer a set of instructions. Giving instructions to a computer is called coding or programming.
Now, you might think coding is typing lots of weird green text on a black screen. Not anymore! Today, we use something called block coding. Block coding means you drag colorful puzzle pieces and snap them together. Each block is an instruction. If the blocks snap together, the instruction works! It is like telling a story with pictures instead of hard words.
This module will teach you the fundamentals of block coding. You will learn how to make a character move, how to make it talk, and how to check if it touches something. By the end, you will have built your very first interactive digital game. All you need is curiosity and the ability to play with shapes. Letâs jump in!
Learning Objectives
By the time you finish this module, you will be able to:
- Explain what block coding is in your own simple words.
- Understand and use the three basic block types: Event, Action, and Control.
- Describe what a sequence is and why order matters.
- Use a loop to repeat an action many times.
- Use a condition (an âifâ block) to make a decision in code.
- Define a variable as a box that holds a number or a word.
- Move a sprite using the X and Y coordinates.
- Create a simple clicker game using block logic.
- Debug a simple block sequence when it does not work.
Warm-up Story: Amara and the Robot Chef
Amara was Kolaâs little sister. After watching Kola make his dirt game, she wanted to build something too. But Amara loved cooking more than running. She dreamed of a robot chef that could make puff-puff for the whole family.
She took a big paper and drew squares. In the first square, she wrote âWake up.â In the second, âCheck if there is flour.â In the third, âIf yes, mix flour and sugar. If no, shout for Mum.â She connected the squares with arrows. It looked like a treasure map of instructions.
Her big brother Kola looked at it and laughed. âAmara, you just wrote a program! You are a coder!â Amara did not know what coding meant. She just knew she was telling a robot exactly what to do, step by tiny step. When she got a tablet from school, she opened a block coding app. The blocks looked exactly like her paper squares! She dragged a âstartâ block, then a âcheckâ block, then a âsayâ block. Her robot chef was born on screen. It did not fry real puff-puff, but it showed an animation of it! Amara had become a coder without even realizing it. And so have you.
Main Lessons
Lesson 1: What Is Block Coding?
Definition: Block coding is a way of programming where you use visual, colorful blocks that snap together instead of typing complicated text.
Why it is important: Typing text code is hard because a missing dot or comma can break the whole game. Blocks fit only if they make sense. This lets you focus on the logic, not on spelling strange words.
Simple explanation: Imagine you have a box of toy train tracks. Some pieces are straight, some are curves. You cannot snap a curve onto a straight piece upside down. The pieces only fit if the connection is right. Block coding works the same way. Each block is a piece of track. Your train (the computer) follows the track you built.
Real-life example: A picture-based instruction manual for a bookshelf. It shows step 1, step 2, step 3 with clear icons. No confusing words.
School example: A visual timetable on the classroom wall. The Monday block shows a picture of a math book, then a break apple, then an English book.
Home example: A chore chart with pictures. Brush teeth, make bed, eat breakfast. Each is a block.
Nigerian example: Think of the street signs in Lagos. A âno parkingâ sign is a clear visual block that gives an instruction. Block coding is just a row of signs telling the computer what to do.
Illustration:
[Start]---->[Move 10 steps]---->[Say Hello!]---->[Stop]
^ ^ ^ ^
Event Action Action Control
Mini Summary: Block coding is dragging, dropping, and snapping colorful instruction blocks together. It is coding without the typing pain.
Lesson 2: The Three Families of Blocks: Event, Action, Control
Definition: Almost every block belongs to one of three families: Events (when to start), Actions (what to do), and Control (how the flow works).
Why it is important: If you can spot these three families, you can read any block code in the world, even if you donât know the exact app.
Simple explanation: Think of a school day. Event: The bell rings. Action: You stand up and walk to the next class. Control: You walk only if the bell is for your class; else, you stay. Events start the magic. Actions do the magic. Control decides the path of the magic.
Real-life example: A traffic light. Event: Light turns green. Action: Car moves forward. Control: If the light stays green, keep moving; if it turns yellow, slow down.
School example: Event: Teacher asks a question. Action: You raise your hand. Control: Wait if someone else is speaking.
Home example: Event: Baby cries. Action: Mum picks the baby up. Control: If the baby is hungry, feed; if wet, change diaper.
Nigerian example: A conductor in a danfo bus. Event: A passenger waves. Action: Conductor shouts "Stop!". Control: If the bus is full, don't stop.
Illustration:
+----------------+ +----------------+ +----------------+
| EVENTS | | ACTIONS | | CONTROL |
| (When) | | (What) | | (How) |
+----------------+ +----------------+ +----------------+
| when green | | move 10 steps | | repeat 10 times|
| when clicked | | say "Hello!" | | if... then... |
| when key pressed| | change color | | wait 1 second |
+----------------+ +----------------+ +----------------+
Mini Summary: Events start, Actions happen, Control manages the flow. Every program is a mix of these three families.
Lesson 3: Sequence â The Order Matters!
Definition: A sequence is the exact order of instructions. The computer follows the blocks one after the other, from top to bottom.
Why it is important: If you put your socks on after your shoes, your feet will hurt. If you tell the computer to âSay Goodbyeâ before âSay Hello,â the story makes no sense. The order is everything.
Simple explanation: A sequence is like a recipe. Step 1: Crack the egg. Step 2: Mix. Step 3: Fry. You cannot fry before you crack the egg. Code works the same stubborn way. It reads top to bottom.
Real-life example: A morning routine: Wake up, then brush teeth, then eat breakfast. You cannot eat breakfast before waking up!
School example: Solving a math problem: First read the question, then write the formula, then calculate, then write the answer.
Home example: Making tea: boil water, put tea bag in cup, pour water, add milk.
Nigerian example: Pounding yam: First boil the yam, then peel it, then pound in the mortar. Do it in the wrong order and you get a mess!
Illustration:
Correct Sequence:
[Start]-->[Move]-->[Turn]-->[Jump]-->[End]
Wrong Sequence:
[Start]-->[Jump]-->[Turn]-->[Move]-->[End]
(Character jumps into a pit because it didn't turn away first!)
Mini Summary: The computer reads your blocks in strict order, like a bossy chef reading a recipe. Make sure the steps are in the right sequence.
Lesson 4: Loops â Doing Things Again and Again
Definition: A loop is a block that repeats one or more actions. You tell it how many times to repeat, or you tell it to repeat forever.
Why it is important: Without loops, you would need to drag the âwalkâ block 100 times to cross a room. A loop says âwalk 100 timesâ in just one block. It saves time and makes the game loop possible.
Simple explanation: Your heart loops. It goes thump-thump, thump-thump, forever. It does not do one thump and stop. A game loop repeats the input, update, render sequence forever until you quit.
Real-life example: A skipping rope. You swing the rope, jump, swing, jump. This is a loop until you trip.
School example: Writing lines as punishment: âI will not talk in class.â You write it 50 times. That is a loop.
Home example: Washing plates: Pick plate, scrub, rinse, stack. Repeat until no plates left.
Nigerian example: A woman frying akara balls. She scoops batter, drops in oil, waits, removes. She loops this until the batter bowl is empty.
Illustration:
+----------------------------+
| REPEAT 4 TIMES |
| [Move 10 steps] |
| [Turn Right 90 degrees] |
+----------------------------+
Result: A square path!
Mini Summary: A loop is a repeat machine. Use it when you want the computer to do something many times without getting bored.
Lesson 5: Conditions â Making Choices with âIfâ
Definition: A condition is a yes-or-no question the computer asks. The âIfâ block runs the code inside it only if the answer is YES (true).
Why it is important: Games need decisions. âIf the player touches the coin, increase score. If the player touches the lava, end the game.â Without conditions, games cannot be interactive.
Simple explanation: Imagine a security guard at a gate. He checks every person. âIf you have a ticket, enter. Else, go home.â The guard is an âIf-Elseâ block. The question âDo you have a ticket?â is the condition.
Real-life example: Weather check. âIf it is raining, take an umbrella. Else, wear sunglasses.â
School example: âIf your score is above 80%, you get a gold star. Else, try again.â
Home example: âIf the phone battery is less than 10%, plug it in. Else, keep playing.â
Nigerian example: A bus driver at a checkpoint. âIf it is a soldier waving, stop. Else, keep driving.â
Illustration:
+------> [Is key pressed?] --YES--> [Move character]
| |
| NO
| |
+-------<-- (Wait) <--+
Mini Summary: âIfâ blocks make games smart. They let the computer make decisions based on what is happening right now.
Lesson 6: Variables â Boxes for Your Stuff
Definition: A variable is a named box in the computerâs memory where you can store a number or a word. You can look inside, change whatâs inside, or use it later.
Why it is important: A game needs to remember things: your score, your name, how many lives you have left. Variables are the memory of the game.
Simple explanation: Think of a locker in school. You put your bag inside and close the door. The locker has a label: "Amaraâs Locker." The label is the variable name. The bag inside is the value. You can swap the bag for a lunchbox, and the value changes, but the label stays.
Real-life example: A bank account. The balance is a variable. When you put money in, the number goes up. When you buy something, it goes down.
School example: A class register. The list of names is a variable that holds the names of all students present today.
Home example: The shopping list stuck to the fridge. You write items down (store). You cross them off (change). You read what is next (use).
Nigerian example: A market traderâs record book. The book page for "Tomatoes" has a number. As she sells, the number reduces. As she restocks, the number increases. The page is a variable.
Illustration:
+---------------------+
| Variable: Score |
| Value: 0 |
+---------------------+
|
| (Player eats coin)
v
+---------------------+
| Variable: Score |
| Value: 10 |
+---------------------+
Mini Summary: A variable is a storage box with a name. It remembers numbers or words for your game.
Lesson 7: Moving Sprites with Coordinates
Definition: In block coding, you can change a spriteâs X and Y coordinates using action blocks. This is how characters walk, fall, and fly on screen.
Why it is important: Remember Module Six? We said games are just changing numbers and redrawing. Here, we actually change those numbers with blocks.
Simple explanation: The screen is a giant graph paper. The cat sprite is sitting at (0,0). You grab a âchange X by 10â block and snap it under a âwhen right arrow pressedâ event. Every time you press the right arrow, the catâs X goes up by 10 pixels. It slides to the right!
Real-life example: Moving a magnet on a fridge door. Each push changes its position a little bit.
School example: A marker on a whiteboard. The teacher wipes it and draws in a new place. The coordinate of the drawing changed.
Home example: A toy car on a playmat. Your hand pushes it from one street to another.
Nigerian example: A boat on the Lagos Lagoon. The boatman paddles, and the boat's position (coordinate) changes relative to the shore.
Illustration:
Event: [When Right Arrow Key Pressed]
|
v
Action: [Change X by 10]
|
v
Result: Sprite slides right
Mini Summary: We bring sprites to life by connecting key press events to âchange Xâ or âchange Yâ blocks. Every button tap adds or subtracts to the coordinate.
Lesson 8: Collision Detection in Blocks
Definition: Block coding has special sensing blocks that ask âAm I touching this sprite?â or âAm I touching this color?â These are used to detect collisions.
Why it is important: This is the block version of our collision lesson. It lets you collect coins, hit enemies, and open doors.
Simple explanation: You place a âtouching [object]?â block inside an âIfâ block. It becomes the question. âIf I am touching the coin sprite, then change score by 1 and hide the coin.â
Real-life example: A goalkeeperâs gloves touching the ball. The referee (the computer) checks: Did the glove touch the ball? Yes. Save!
School example: Playing dodgeball. A player asks themselves: âDid the ball touch me?â If yes, they are out.
Home example: A cat pawing at a toy mouse. The catâs brain: âIf paw touches mouse, then pull it closer.â
Nigerian example: Playing âTinko Tinkoâ (a clapping game). Your hands must meet. Your brain detects the collision of your two hands.
Illustration:
Event: [Forever Loop]
|
v
Control: [If touching "Coin"?]
|
YES ---> [Change Score by 1]
[Play sound "Ding"]
[Hide Coin]
|
NO ----> (Do nothing)
Mini Summary: Use the touching block inside an if-block. This is the magic recipe for collecting anything in a game.
Lesson 9: Broadcasting â Sending Secret Messages
Definition: A broadcast is a message one sprite sends to all other sprites or the stage. It is like shouting in a room. Anyone listening can react.
Why it is important: Sprites need to talk to each other. When the boss monster dies, it must broadcast âIâm dead!â so the gate sprite opens. Without broadcasts, sprites are lonely islands.
Simple explanation: Think of a football referee blowing a whistle. The whistle is a broadcast. Every player hears it and stops. The referee did not tap each player on the shoulder. He just sent a sound message to all.
Real-life example: A school bell. It broadcasts âClass is over!â to the whole school. Students react (pack bags), teachers react (stop teaching).
School example: Morning assembly. The drum or gong sounds. Everyone runs to the field.
Home example: A smoke alarm beeping. It broadcasts âDanger! Smoke!â to everyone in the house.
Nigerian example: A town crier in the village. He beats the gong and shouts a message. Everyone hears the broadcast and gathers.
Illustration:
Sprite 1 (Boss): [Broadcast "Game Won"]
|
+---------------+---------------+
| | |
v v v
Sprite 2 (Gate): Sprite 3 (Music): Sprite 4 (Score):
[When I receive [When I receive [When I receive
"Game Won"] "Game Won"] "Game Won"]
[Open] [Play Victory] [Show Final Score]
Mini Summary: Broadcast blocks let sprites talk to each other wirelessly. One shout, many reactions.
Lesson 10: Clones â Making Copies of Sprites
Definition: A clone is a perfect copy of a sprite that appears during the game. You can have one original sprite, but create a hundred copies of it while the game runs.
Why it is important: Think of a space shooter game. Hundreds of asteroids come at you. You do not draw 100 separate sprites. You have one asteroid sprite and you clone it 100 times.
Simple explanation: You have one sheet of gold star stickers. You want to give a star to 20 friends. You have only one design, but you make 20 copies (clones) and hand them out. The original sheet stays safe.
Real-life example: A photocopier machine. You put one paper in, press copy, and it makes many identical pieces of paper.
School example: Your teacher prints a worksheet. One original digital file, but 30 printed copies for the class.
Home example: Baking cookies with a single star-shaped cutter. The dough is the raw material, and you stamp out many star cookies.
Nigerian example: A textile maker using one wooden stamp to print the same pattern many times on a long cloth.
Illustration:
Original Sprite (Coin)
|
v (When Green Flag Clicked)
Repeat 10 times:
[Create Clone of Myself]
[Move Clone to Random Position]
Mini Summary: Clones let you create an army from one sprite. Great for coins, enemies, or falling stars.
Lesson 11: User Interface (UI) â Buttons and Scoreboards
Definition: UI, or User Interface, are the parts of the game the player sees and touches to control things or get information. This includes buttons, score text, health bars, and menus.
Why it is important: A game without a scoreboard is confusing. How do you know if youâre winning? A game without a start button doesnât feel like a game. UI connects the playerâs eyes and fingers to the game logic.
Simple explanation: Imagine a TV remote. The rubber buttons are the UI. The screen showing the channel number is the UI. Without them, you would be stabbing in the dark.
Real-life example: A carâs dashboard. The speedometer, fuel gauge, and radio buttons are all UI.
School example: Your report card. The names of subjects and the grades are the UI. It shows your performance clearly.
Home example: A microwaveâs keypad and display. You press numbers (UI) and the timer counts down (UI).
Nigerian example: A POS machine. The screen shows prompts like âEnter PIN,â and the buttons let you type. Thatâs a transaction UI.
Mini Summary: UI is the bridge between the player and the code. Design it to be clear and easy.
Lesson 12: Timers and Waiting â Patience in Code
Definition: A timer block lets you pause the game or wait for a certain number of seconds before the next action.
Why it is important: If a game just blinks everything instantly, it is unplayable. We need delays. âShow this message for 2 seconds, then hide it.â Timers control the speed of the story.
Simple explanation: A traffic light doesnât snap from green to red. It holds yellow for a few seconds to give drivers time to react. The âwaitâ block is the yellow light.
Real-life example: A camera timer. You press the button, wait 10 seconds, and flash! The picture is taken.
School example: A countdown for a test. The teacher says, âYou have 30 minutes left.â
Home example: Boiling an egg. You wait 5 minutes exactly, then remove it from the fire.
Nigerian example: Suya roasting. The mallam puts meat on fire and waits a specific time before flipping it.
Illustration:
Sequence:
[Say "Ready?"]
[Wait 1 second]
[Say "Set..."]
[Wait 1 second]
[Say "GO!"]
Mini Summary: The wait block is the pause button inside a sequence. It makes games breathe.
Lesson 13: Debugging â Fixing the Broken Blocks
Definition: Debugging means finding and fixing errors (bugs) in your block code so the game works as you planned.
Why it is important: Every coder makes mistakes. Even adults with 20 years of experience write bugs. Debugging is not failure; it is the normal, healthy way to build code.
Simple explanation: You build a tall Lego tower. You put a heavy block on top and the whole tower leans. You look closely, find the thin Lego piece that snapped wrong, and fix it. That is debugging.
Real-life example: A bicycle chain falls off. You stop, look at the gears, and put the chain back on correctly. You debugged the bike.
School example: Re-reading your essay and finding a spelling mistake. You erase it and write the correct word.
Home example: Your light bulb does not turn on. You check: is it plugged in? Is the bulb burnt out? You test step by step.
Nigerian example: A generator not starting. The mechanic checks fuel (variable check), spark plug (event check), and oil. He debugs the engine step by step.
Mini Summary: Debugging is detective work. Check your blocks one by one, read the sequence, and find the broken link.
Lesson 14: Sounds and Looks â The Fun Blocks
Definition: These are action blocks that change how a sprite looks (costumes, size, color) or sounds it makes (play sound, change volume).
Why it is important: A silent, stiff game is no fun. Looks and sounds blocks add juice and flavor. They make the player feel rewarded.
Simple explanation: You are acting in a play. Changing your costume (Looks block) shows the audience a new character. Speaking a loud line (Sound block) makes them laugh or gasp.
Real-life example: A firework display. The explosion is a visual look, the boom is the sound.
School example: A school concert. Singers change outfits and the band plays music.
Home example: A birthday party. Balloons are looks, singing âHappy Birthdayâ is sound.
Nigerian example: Masquerades at a festival. The masquerade changes its movements (animation/looks) and the drummers beat intense rhythms (sound).
Mini Summary: Sprinkle sound blocks and look blocks on your game to make it sparkle and pop.
Lesson 15: Putting It All Together â Your First Game Loop in Blocks
Definition: This is the moment we build the actual game loop from Module Six using blocks. A forever loop that checks input, updates variables, and renders changes.
Why it is important: This proves you understand everything. You are now translating theory into a real, running game.
Simple explanation: We will build a simple âCollect the Ballsâ game. A bowl follows the mouse (Input). Balls fall from the sky (Update). The score goes up (Render). Letâs wire it up.
Recipe:
1. Event: When Green Flag clicked.
2. Control: Forever Loop.
3. Action: Set Bowl X to Mouse X (follow finger).
4. Control: If Bowl touches Ball.
5. Action: Change Score by 1, move Ball to top, play pop sound.
Real-life example: A goalkeeper game machine in an arcade. You slide a handle (input), the ball shoots (update), and lights flash with the score (render).
School example: A pop quiz game where the teacher shows a question, you buzz in, and the board updates points.
Home example: A baby stacking rings. Input: baby picks a ring. Update: ring slides down pole. Render: pole grows more colorful.
Nigerian example: A digital version of âWhotâ cards. You drag a card to the pile. The game checks if the number matches. If it does, your card vanishes and your score updates.
Illustration:
[When Green Flag Clicked]
|
v
[Forever]
|
+---> [Set Bowl X to Mouse X]
|
+---> [If touching Ball?]
|
YES ---> [Change Score by 1]
[Go to Ball: Move to Random Top]
[Play sound Pop]
Mini Summary: You just built a game loop! Input (mouse), Update (collision check), Render (automatic redraw). You are officially a game programmer.
Key Vocabulary
| Word | Simple Definition |
|---|---|
| Block Coding | Programming with colorful puzzle pieces. |
| Event | A block that starts something (like a green flag). |
| Action | A block that does something (move, say, play sound). |
| Control | A block that controls flow (loop, if, wait). |
| Sequence | The order of instructions. |
| Loop | Repeating an action many times. |
| Condition | A yes/no check (if block). |
| Variable | A box that stores a number or word. |
| Coordinate | X and Y position on the screen. |
| Collision | Checking if sprites are touching. |
| Broadcast | A message sent to all sprites. |
| Clone | A copy of a sprite. |
| UI | User Interface; buttons and scoreboards. |
| Debug | Finding and fixing errors in code. |
| Timer | A wait block that pauses. |
Important Concepts
The Block Trinity: Event, Action, Control. If you canât find a block, ask yourself: âAm I trying to start something (Event), do something (Action), or manage the flow (Control)?â
Data Flow: Variables store information. Events trigger the reading of that information. Actions change the information. This is how a simple clicker game works.
Readability: Good block code is easy to read by a friend. Snap blocks into small, logical groups. Donât make a 50-block long snake. It should look neat.
Step-by-Step Explanations: Building a Coin Collector
- Step 1: Choose a character sprite (e.g., a lion).
- Step 2: Choose an item sprite (e.g., a coin).
- Step 3: From Events, drag "When Flag clicked" for the lion.
- Step 4: From Control, snap in a "Forever" loop.
- Step 5: Inside, from Motion, place "Set X to Mouse X" and "Set Y to Mouse Y".
- Step 6: For the coin, create a variable called "Points".
- Step 7: In the lionâs forever loop, add an "If touching Coin?" block.
- Step 8: Inside the If: "Change Points by 1", "Play sound Collect", "Move Coin to random position".
- Step 9: Click the Green Flag and test!
Flag --> Forever --> Follow Mouse --> If touch Coin --> Score up!
Real-life Examples of Block Coding
- A microwaveâs digital panel is block code for heating: Event (Start), Action (Heat), Control (If door open, stop).
- A vending machine: Event (Coin inserted), Action (Spiral turns), Control (If item in stock).
- Traffic lights are programmed with loops, waits, and conditions exactly like block code.
Nigerian Examples
- Ogbonge Engineer: Imagine coding a traffic robot for Ojota. Green light waits 30 seconds, then yellow 5 seconds, then red. Thatâs a sequence with timers.
- Jollof Rice Recipe: Writing the steps as blocks: "If Rice is soft, then add tomato stew. Else, wait 5 minutes and check again."
- Keke Napep: Starting the keke (Event), accelerating (Action in a loop), checking for bumps (Condition).
Fun Examples
- Dancing Sprite: Use a loop to change costumes 10 times. It looks like a dance!
- Pet Feeding Game: If you click the pet, it broadcasts "Feed Me" and the food bowl slides over.
- Ghost Clones: Create a clone of a ghost every 2 seconds. The screen fills with spooky but silly ghosts.
Everyday Examples
- An elevator button: Event (press floor), Control (if weight OK, close door), Action (move to floor).
- A TV remote: Event (button press), Action (change channel), Control (if volume down, lower limit).
Teacher Notes
This module is best taught with a projector and a live block coding environment like Scratch or MakeCode. Do not let students memorize blocks. Instead, let them pull blocks apart and see what breaks (debugging). The "Human Block" activity is very effective: write blocks on large papers and have students act out the sequence. Emphasize that getting errors is part of learning. Celebrate every bug found as a step closer to understanding.
Parent Tips
Your child will likely want screen time for "coding." This is creative screen time! Sit with them and ask them to explain their block stack to you. If you donât understand code, ask, âWhat happens if you pull this block off?â Their explanation will deepen their learning. Try the offline ârecipeâ game: give them crazy instructions in the wrong order (Put shoes, then socks) and have them debug you.
Interesting Facts
- Scratch, the most famous block coding language, was created by a group at MIT for children exactly like you.
- The color coding of blocks (yellow for Events, blue for Motion) is designed to help your brain quickly sort them.
- Some professional game developers use visual scripting blocks for very complex games because it makes logic easier to read.
- Nigerian schools are now participating in the Hour of Code using block tutorials.
Did You Know?
Did you know that the "Forever" loop runs about 30 times per second in Scratch? That means your "if touching" check is running super fast, so it feels instant when you catch a coin!
Did you know that a variable can hold not just numbers, but also names like "Player1"? You can even join two words together using a block that works like glue.
Remember This
- Code is just giving orders in the right order.
- If it doesnât work, check the sequence.
- Events start, Actions do, Control manages.
- A variable is a memory box.
- Debugging is not failing; it is smart fixing.
Common Mistakes
- Forgetting the Forever loop: Putting an "If key pressed" block without a forever loop. The game checks only once and stops.
- Wrong variable scope: Creating the "Score" variable for one sprite only and wondering why another sprite canât change it. Make it "For all sprites."
- Sequence slip: Telling the sprite to hide before moving. The player might see it vanish in the wrong spot.
- Broadcast echo: A broadcast that triggers another broadcast in a never-ending loop, crashing the game.
Best Practices
- Test one block at a time. Donât snap 20 blocks, then test. Snap 2, test. Snap 2 more, test.
- Name your variables clearly. âScoreâ is good. âVariable1â is confusing.
- Clean up your code space. If a sprite is not used, delete it. A clean screen helps you think.
- Use comments. Right-click a block and add a comment explaining what it does.
More Visual Aids
Flowchart: Decision in a Game
Player presses "Space"
|
v
Is Energy > 0?
/ \
YES NO
/ \
Jump! Say "Tired!"
|
v
Subtract Energy
Timeline: Learning Block Coding
Hour 1: Learn to drag and snap
Hour 2: Move the cat with keyboard
Hour 3: Catch a star using collision
Hour 4: Add a score variable
Hour 5: Build the whole Game Loop!
Table: Block Types and Colors (Typical)
| Block Shape | Color Family | Job |
|---|---|---|
| Hat Block (curved top) | Yellow/Gold | Events |
| Rectangle | Blue | Motion |
| Rectangle | Purple | Looks |
| Rectangle | Pink/Magenta | Sound |
| "C" Shape | Orange | Control (Loop/If) |
| Rounded Ends | Green | Operators (Math) |
| Rectangle | Red/Orange | Variables |
Comparison: Text Code vs Block Code
| Feature | Text Code (Python / Lua) | Block Code (Scratch) |
|---|---|---|
| Typing skill needed | High (exact spelling) | Low (drag and drop) |
| Memory needed | Must memorize commands | Commands are visible in menus |
| Error risk | One dot breaks everything | Blocks donât snap if wrong |
| Flexibility | Very high (can do anything) | High, but limited to available blocks |
| Best for beginners? | Absolutely not | Absolutely yes! |
End-of-Module Summary
Fantastic job, coder! You have completed Module Seven. You have made the big jump from paper planning to digital building. Letâs remember this journey:
- You became Amara, telling a robot exactly what to do.
- You learned that block coding uses colorful puzzle pieces: Events (the starters), Actions (the doers), and Control (the managers).
- You built Sequences and realized that putting socks on after shoes is a bug!
- You harnessed the power of Loops to repeat without boredom, and Conditions to make smart choices.
- You stored precious memories in Variables and moved sprites with Coordinates.
- You made things collide, broadcast messages, and cloned an army of sprites.
- Finally, you built a beautiful UI, debugged like a detective, and wove it all into a real Game Loop.
You are no longer just a player. You are a builder. You talk to machines. That is a superpower. Use it wisely and keep creating!
Frequently Asked Questions (FAQs)
- Q: Do I need to install anything?
A: Most block coding tools like Scratch work on a web browser. No installation is needed! - Q: Can I make a 3D game with blocks?
A: Usually, block coding is for 2D games. 3D needs heavier tools, but the logic you learned here is exactly the same. - Q: My block wonât snap. Why?
A: The shapes must match. A round hole needs a round peg. Check if youâre trying to put a check block into a number slot. - Q: What is a sprite costume?
A: A costume is just another picture for the same sprite. Switching costumes is what makes animation. - Q: Can I share my block game with friends?
A: Yes! Most platforms have a âShareâ button that gives you a link to send to friends. - Q: Why does my clone look wrong?
A: Did you hide the original sprite and only show the clones? The original might be sitting on top! - Q: How do I stop a forever loop?
A: Use a âStop Allâ block inside a condition, like âIf Score = 10, Stop All.â - Q: Is block coding real coding?
A: Yes! Real logic, real rules, real results. The only difference is you use a mouse instead of a keyboard. - Q: Can I make a career out of this?
A: Many professional game designers started with block coding. It teaches the brain to think logically. - Q: My game is slow. What happened?
A: You might have too many clones or a forever loop that creates things non-stop. Add a âwaitâ or limit the clones.
Review Questions (15 Questions)
- What are the three main families of blocks?
- Explain why a sequence matters in code.
- What block do you use to make something repeat 20 times?
- What keyword starts a yes/no question block?
- If you want to store a playerâs name, what do you create?
- Which block type is used for âWhen Green Flag Clickedâ?
- How does a sprite move to the right?
- What is the âtouchingâ block used for?
- If you want all sprites to know the game is over, what block do you use?
- What is a copy of a sprite called?
- Why do we use a âWaitâ block?
- What is the screen display for a score called?
- What do we call fixing an error in code?
- What is the magical loop that makes a game run forever?
- Describe a âForeverâ loop in words.
Fill-in-the-Blank Exercises
1. The three block families are Event, Action, and ________.
2. A ________ is a box that stores a number or word.
3. A repeating block is called a ________.
4. The âIfâ block asks a Yes or No ________.
5. To copy a sprite, we make a ________.
6. X is the horizontal ________.
7. The ________ block sends a message to all sprites.
8. We find bugs by ________.
9. The block that pauses the code is the ________ block.
10. The ________ button usually starts the game.
True or False Exercises
1. Blocks can snap in any order without problems. False
2. A variable can only hold numbers. False (It can hold words too)
3. The âForeverâ loop runs only once. False
4. The âIfâ block is a Control block. True
5. Debugging means making the game harder. False
6. A broadcast is a secret whisper between two sprites only. False (Everyone hears it)
7. Sequence is the order of instructions. True
8. UI stands for Under Instruction. False (User Interface)
9. Clones are perfect copies that can do things independently. True
10. The "touching" block is used for collision detection. True
Multiple Choice Questions (15 Questions)
- What is block coding?
a) Typing long commands
b) Dragging and snapping puzzle pieces
c) Drawing pictures only
Answer: b - Which block family does âWhen Green Flag Clickedâ belong to?
a) Action
b) Control
c) Event
Answer: c - A loop is used for:
a) Changing color
b) Repeating actions
c) Stopping sounds
Answer: b - What does a variable do?
a) Changes the volume
b) Stores data
c) Closes the game
Answer: b - The question part in an âIfâ block is called a:
a) Guess
b) Condition
c) Event
Answer: b - To move a sprite right, you change its:
a) Y coordinate
b) Sound pitch
c) X coordinate
Answer: c - What does âbroadcastâ do?
a) Sends a message to one specific sprite
b) Sends a message to all sprites
c) Turns on the microphone
Answer: b - A clone is:
a) A new name
b) A perfect copy
c) A type of bug
Answer: b - UI means:
a) Unreal Inventory
b) User Interface
c) Ultra Input
Answer: b - Debugging is:
a) Removing insects
b) Finding and fixing errors
c) Deleting the game
Answer: b - Which block pauses the game?
a) Forever
b) Wait
c) Repeat
Answer: b - The Game Loop is usually wrapped in what block?
a) One-time event
b) Forever loop
c) Broadcast
Answer: b - If you forget the Forever loop, your game will:
a) Run too fast
b) Run only once
c) Explode
Answer: b - To check a collision, you use:
a) The wait block
b) The touching block
c) The hide block
Answer: b - The best way to test your block code is:
a) Snap all blocks at once and hope
b) Snap a few blocks, test, then add more
c) Never test, just share it
Answer: b
Matching Exercises
Match the word to its meaning:
| Word | Match | Meaning |
|---|---|---|
| 1. Variable | A | A puzzle piece that tells the computer what to do |
| 2. Block | B | A storage box for numbers or text |
| 3. Condition | C | A copy of a sprite |
| 4. Clone | D | A yes/no check |
| 5. Sequence | E | The exact order of steps |
Answers: 1-B, 2-A, 3-D, 4-C, 5-E
Short Answer Questions
- Describe the difference between an Event block and an Action block.
- Explain what happens if you place a "Move 10 steps" block outside of a loop versus inside a loop.
- Why is the "Forever" block the perfect home for a game loop?
- Write a step-by-step plan (a pseudo-code block recipe) for a space shooter game where a rocket catches stars.
- How does broadcasting help the different parts of a game work together?
Scenario-based Exercises
- Scenario: Your character moves left when you press the right arrow. What is the bug? (Answer: You likely put "Change X by -10" for the right arrow, or you mixed up the left and right keys.)
- Scenario: You have a coin clone that just sits there and doesnât disappear when touched. List two things you should check. (Answer: Is there a "touching" block in the cloneâs code? Does the clone run its own script? Is the collision check inside a loop?)
Group Activity: The Human Block Relay
Goal: Act out a block sequence.
- Print large cutouts of block shapes: Event (Hat), Action (Move, Say), Control (Repeat).
- Form a line of five students.
- The teacher holds an "Event" block and says "Go!"
- Student 1 runs to the board (Action: Move).
- Student 2 draws a circle (Action: Draw).
- Student 3 checks if the circle is red (Control: If).
- Student 4 shouts "Itâs blue!" (Action: Say).
- Student 5 holds a "Repeat 2 times" sign and sends the first student back to run again!
- Discuss how the flow felt.
Individual Activity: Debugging the Backwards Code
You will receive a broken block sequence from your teacher (e.g., Say Goodbye, Wait, Say Hello, Move). Rewrite it in the correct order so the character walks forward, says "Hi!", waits, and then says "Bye!".
Classroom Discussion Questions
- If you could invent any new block to do anything you want, what would it do and what color would it be?
- Which is harder: being the game designer (planning) or the game programmer (coding the blocks)? Why?
- Why do you think computers are so strict about the sequence?
- How can block coding help you in subjects other than computer class?
Mini Project: The Talking Machine
Build a block project without any motion. Use only Events, Looks, and Sound. Create a character that tells a joke when you press the spacebar, looks surprised when you press "S", and loops a funny dance when you click the flag. Focus purely on sequencing and broadcasting.
Practical Assignment: My First Digital GDD
Take your Game Design Document (GDD) from Module Six. Inside a block coding app, place the first 5 blocks that start the game. For example: âWhen Green Flag clickedâ, âSet Score to 0â, âShow Title Screenâ, âWait 2 secondsâ, âBroadcast Start Gameâ. Do not build the whole game, just the exact start.
Challenge Exercise: The Password Gate
Create a gate sprite that asks for a password using a question block. The player types the answer. If the password is âJollofâ, the gate opens (hides) and broadcasts âAccess Grantedâ. If the password is wrong, the gate shakes and says âTry Againâ. Use variables to track attempts and lock out after 3 failed tries.
Quiz Answers (Quick Reference)
Fill-in-the-Blanks: 1.Control, 2.Variable, 3.Loop, 4.Condition, 5.Clone, 6.Coordinate, 7.Broadcast, 8.Debugging, 9.Wait, 10.Flag.
True/False: 1.F, 2.F, 3.F, 4.T, 5.F, 6.F, 7.T, 8.F, 9.T, 10.T.
MCQ Answers: See the answer key under each question (all B options).
Key Takeaways
- Block coding is logical play. You think, you snap, you test.
- Events, Actions, Control. Master these three and you master all games.
- Bugs are clues. Every broken block teaches you something new.
- You control the machine. The computer is fast, but it only does what you say.
- Start small, dream big. A clicker game today can be an adventure game tomorrow.
Preparation for the Next Module: Module Eight â Building Your First Complete Game
You have done it! You wrote code with blocks and built a simple game loop. In Module Eight, we will take everything from Modules Six and Seven and combine them into one full project.
We will build a multi-level adventure game. You will design the art, code the controls, manage the score across different screens, and add a boss fight.
To prepare for Module Eight, please do this:
- Look at your favorite simple mobile game. Can you guess what the blocks for the main character would look like?
- Draw a flowchart on paper for a two-level game: a forest level and a castle level. How does the player move from forest to castle? (Hint: Itâs a broadcast!)
- Practice using the "Ask" block and the "Answer" variable. We will use player input more in the next module.
Get ready to become a full game architect. You have the tools, you have the talent. Letâs build an epic game! See you in Module Eight.
End of Module Seven. High five, brilliant coder!







