Introduction to Scratch Programming
Scratch is a block-based programming platform developed by MIT that helps children, beginners, and hobbyists learn the basics of programming through interactive and visual tools. It allows users to create stories, games, and animations by simply dragging and dropping blocks.
One of the most powerful and foundational aspects of Scratch programming is motion blocks—used for controlling sprite movements and building dynamic, interactive projects.
What Are Motion Blocks in Scratch?
Motion blocks are categorized under the blue block palette in Scratch and are primarily used to control the movement and positioning of sprites.
These blocks allow you to:
- Move sprites forward or backward
- Rotate them
- Set their coordinates
- Make them glide smoothly across the screen
- Point them toward the mouse or another sprite
- Bounce them off edges
✅ Benefits of using motion blocks:
- Bring characters to life
- Create smooth animations
- Design interactive games
- Track sprite positions in real-time
Understanding the Scratch Interface
Before jumping into motion blocks, it’s important to understand Scratch’s interface:
- Stage: Where the sprites perform actions
- Code Area: Drag blocks here to write scripts
- Block Palettes: Categories like Motion, Looks, Sound, Events, etc.
- Sprite List: Shows all your characters or objects
- Code Tab: Where you design the logic of your game or animation
By default, when you open Scratch, the Motion block palette is selected, ready for use.
List of Motion Blocks and Their Uses
Here’s a detailed explanation of all Motion blocks in Scratch, categorized by purpose.
1. Movement Blocks
Block | Function |
---|---|
move (10) steps | Moves the sprite forward by the specified steps |
turn clockwise (15 degrees) | Rotates the sprite clockwise |
turn counterclockwise (15 degrees) | Rotates the sprite counterclockwise |
go to [random position/mouse pointer/sprite] | Moves sprite to a specific point |
go to x: ( ) y: ( ) | Sends sprite to defined X, Y coordinates |
2. Smooth Motion Blocks
Block | Function |
---|---|
glide (1) secs to x: ( ) y: ( ) | Glides sprite smoothly over time |
glide (1) secs to [random/mouse] | Similar, but target can be dynamic |
3. Directional Blocks
Block | Function |
---|---|
point in direction (90) | Faces sprite in a specific angle |
point towards [mouse pointer/sprite] | Points sprite toward a dynamic object |
4. Coordinate Adjustment Blocks
Block | Function |
---|---|
change x by (10) | Moves sprite right/left relative to current X |
change y by (10) | Moves sprite up/down relative to current Y |
set x to (100) | Sets absolute X value |
set y to (150) | Sets absolute Y value |
5. Interactive & Bounce Blocks
Block | Function |
---|---|
if on edge, bounce | Sprite bounces when hitting screen edge |
set rotation style [left-right, don't rotate, all around] | Controls how sprite rotates |
x position, y position, direction | Reporter blocks for current sprite values |
🔗 Learn more about each block on Scratch Wiki: Motion Blocks – Scratch Wiki
Scratch Code – How to Use Motion Blocks in Scratch: Live Examples
Here are live examples to help you implement motion blocks in your own projects.
Example 1: Basic Movement
when green flag clicked
move 100 steps
This script moves the sprite 100 steps forward when the green flag is clicked.
Example 2: Rotation Controls
when green flag clicked
turn clockwise 45 degrees
turn counterclockwise 90 degrees
This will rotate the sprite both clockwise and counterclockwise.
Example 3: Move to Mouse Pointer
when green flag clicked
go to mouse pointer
The sprite jumps directly to where your mouse is.
Example 4: Smooth Glide to Position
when green flag clicked
glide 2 secs to x: 150 y: 100
This causes the sprite to smoothly glide to a specific location.
Example 5: Bouncing Ball
when green flag clicked
forever
move 10 steps
if on edge, bounce
This makes the sprite continuously move and bounce when it hits the stage edges.
Enhancing Sprite Movement with Motion Control
Motion blocks can be enhanced using:
- Control blocks: For loops (
forever
,repeat
) - Events blocks: Start movement on keypress or mouse click
- Sensing blocks: Move toward a sprite or interact based on distance
- Variables: Track speed, direction, score, etc.
Example: Follow mouse pointer only when clicked
when this sprite clicked
forever
point towards mouse pointer
move 5 steps
Creating Interactive Projects Using Motion Blocks
Motion blocks form the backbone of interactive Scratch projects.
Game Ideas:
- Maze Game: Use arrow keys + motion blocks to navigate
- Chase Game: One sprite follows another using
point towards
andmove
- Platformer: Jumping using
change y by
, walking withchange x by
Example of Arrow Key Movement:
when green flag clicked
forever
if key (right arrow) pressed
change x by 10
if key (left arrow) pressed
change x by -10
Scratch Game Development with Motion Blocks
To build games like pong, space shooters, or bouncing ball games, motion blocks are essential.
🏓 Pong Game Ball Logic:
when green flag clicked
point in direction 45
forever
move 10 steps
if on edge, bounce
You can enhance with:
- Collision detection using
touching
sensing blocks - Scoring system using variables
- Difficulty levels by increasing speed
Advanced Tips and Animation Enhancements
Tips:
- Use glide for smooth transitions in story animations
- Combine motion with looks blocks to animate sprite expressions
- Use
rotation style
to limit flipping in side-scrolling games - Use
direction
reporters to debug sprite facing issues
Enhancements:
- Add sounds for each movement step
- Use
broadcast
messages to synchronize motion between multiple sprites - Integrate user input to create dynamic interactions
Final Thoughts and Next Steps
Motion blocks are more than just simple sprite movements—they are the heartbeat of interactive animations and games in Scratch. Whether you are just starting or aiming to build advanced games, understanding motion blocks is key.
💻 Start experimenting with motion blocks now: Open Scratch Editor
If you loved this Scratch project,
- Don’t forget to check out the full video tutorial by Kodex Academy here: Master Scratch Motion Blocks with Real-Time Examples | Scratch Tutorial
- Like, comment & share the video
- Visit kodexacademy.com
- subscribe to the Kodex Academy YouTube channel for deeper Scratch content.
Happy coding with Kodex Academy! 🚀