Chitti app logo

Chitti is better in the app

Coins, streaks and builds — free on Android & iOS

Get the app
Chitti logoChitti

Programming to magic stick

5 Minutes · Module 9 - To the Magic Stick

ScratchJr game coding for kids: learn how to program Ben to dodge falling fireballs using messages and loops. A Tamil coding lesson.

  • Programming arrows with color messages to move Ben left and right
  • Making fireballs fall continuously using down motion and loop blocks
  • Setting Ben to reset with the go home block when touching a fireball
What this lesson teachesRead the lesson as text

Scratch Junior games use trigger blocks, color-coded message blocks, and motion loops to control character navigation and handle obstacle collisions. Players guide a character across an obstacle course by tapping control buttons and dodging falling objects that reset progress upon contact.

Sending and receiving motion messages

In Scratch Junior, characters and buttons communicate across the screen through colored message envelopes. The green arrow uses a touch trigger block to send a green message envelope that instructs Ben to move right, while the red arrow sends a red message envelope that instructs Ben to move left. Selecting Ben allows the programmer to place message receive trigger blocks matched to each color, linking them to left or right motion blocks and closing them with an end block.

Programming continuous falling obstacles

Falling fireballs act as hazards that drop from the top of the screen to the bottom without stopping. A start on green flag trigger block begins the movement script, while a downward motion block directs the fireball to travel down the screen. Connecting a repeat loop block from the end category ensures that the fireball falls continuously throughout the game. This exact sequence of blocks is copied to all other fireballs in the project by dragging and dropping the code onto each sprite.

Detecting collisions and resetting

  • A touch trigger block placed on Ben detects when he makes physical contact with another object in the scene.
  • A go home block connects directly after the touch trigger block to return Ben to his original starting location immediately upon touching a fireball.
  • An end block finishes this collision sequence so the character resets every time an obstacle hits him.
  • Running the game in full screen tests whether Ben successfully avoids the falling fireballs or gets sent back home upon contact.

Completing the game challenge

The objective of the Rainfire level is to move Ben safely across the forest without touching any falling fireballs. Reaching the other side allows Ben to join Tom at the location of the magic wand. Once the wand is reached, the quest concludes as the magic wand is handed over to Angel to celebrate clearing the stage.

Part of the course

Scratch Junior

View course →

More in Module 9 - To the Magic Stick

  1. 1Designing to the magic stick6 Minutes
  2. 2Programming to magic stickNow playing