What Scratch is and why it works for beginners
Scratch is a free visual programming environment where you build games by snapping together blocks of code instead of typing text. You don't need to install anything — you work in your web browser at scratch.mit.edu. Each block represents a single instruction: "move 10 steps," "wait 1 second," "if touching mouse-pointer then change color." You stack them together to tell a character what to do.
The reason Scratch works for people new to game-making is that you see results immediately. You click "play," your character moves, and you know whether your code worked. There's no syntax to memorize, no error messages about missing semicolons. If something doesn't work, you can see which block caused it and fix it right there.
Scratch runs on Windows, Mac, and Linux. You can also download the offline editor if you want to work without internet, though the web version is simpler to start with. Your projects save to your Scratch account, so you can come back to them later or share them with other people.
Key Takeaways
- Create a free account at scratch.mit.edu, then start a new project and choose or draw a character (called a sprite) to control.
- Use the "Events" blocks to start your game when the green flag is clicked, and "Motion" blocks to make your sprite move in response to keyboard input.
- Add a second sprite as an obstacle or enemy, then use "Sensing" blocks to detect when your main sprite touches it.
- Keep your first game simple — a sprite that moves around and avoids obstacles teaches you the core skills you'll use in every game you make.
- Test your game constantly by clicking the green flag, because small changes often break things in unexpected ways.
Setting up your account and starting a new project
Go to scratch.mit.edu and click "Sign up" in the top right. You'll need a username, password, and email address. Scratch will send you a confirmation email — click the link to activate your account. Once you're logged in, click "Create" in the top left to start a new project.
You'll see a blank workspace with a white cat sprite already on the stage (the white rectangle in the center). The cat is Scratch's default character. You can keep it, delete it and draw your own, or choose a sprite from Scratch's library. To choose a different sprite, click the icon that looks like a folder next to "New sprite" at the bottom left of the screen.
The workspace has three main areas: the stage on the right (where your game plays), the sprite list at the bottom (showing which characters are in your project), and the blocks panel on the left (where you find the code blocks you need). Above the blocks panel are colored tabs — "Motion," "Looks," "Sound," "Events," and others. Each tab holds blocks that do different things.
Making your sprite move with keyboard controls
Click on your sprite in the sprite list to select it. Then click the "Events" tab in the blocks panel. Drag the block that says "when green flag clicked" onto the code area (the gray space to the right of the blocks panel). This block tells Scratch to start running the code underneath it when someone clicks the green flag above the stage.
Now click the "Control" tab and drag a "forever" block underneath the green flag block. The forever block repeats everything inside it over and over while the game is running. Inside the forever block, you'll put the code that checks whether the player is pressing a key.
Click "Sensing" and drag the block "key [space] pressed?" into the forever loop. Click the dropdown that says "space" and change it to "right arrow." Then go to "Motion" and drag a "move 10 steps" block into the "if" block. Now your sprite will move right whenever the right arrow key is held down. Repeat this process for the left arrow, up arrow, and down arrow keys, using "move 10 steps," "turn 15 degrees," or "change y by 10" depending on how you want your sprite to move.
Click the green flag above the stage to test it. Press the arrow keys and watch your sprite move. If it spins instead of moving smoothly, you used "turn" instead of "move" — delete that block and use "move" instead.
Adding an obstacle or enemy sprite
Click the folder icon next to "New sprite" and choose a sprite from the library — something that looks like an obstacle or enemy. A rock, a wall, or a monster all work. Click on it to add it to your project. You'll see it appear on the stage and in the sprite list at the bottom.
Click on the new sprite to select it. Go to "Motion" and drag a "go to random position" block into a "when green flag clicked" block. This makes the obstacle appear in a different spot each time you start the game. If you want the obstacle to move, add a "forever" block and put "move 5 steps" inside it, then add a "if on edge, bounce" block so it bounces off the edges of the stage instead of disappearing.
Now click back on your main sprite (the one the player controls). Go to "Sensing" and find the block "touching [sprite1]?" — click the dropdown and change it to the name of your obstacle sprite. Drag this block into an "if" block inside your forever loop. Inside that if block, put a "say [Hello!] for 2 seconds" block or a "play sound [pop]" block. Now when your sprite touches the obstacle, something will happen.
Adding a score and win condition
Click the "Variables" tab and click "Make a Variable." Name it "score" and click OK. A new block called "set score to 0" will appear in the Variables tab. Drag it into a "when green flag clicked" block at the top of your main sprite's code — this resets the score to zero every time the game starts.
Now add a second obstacle sprite (or duplicate the first one by right-clicking it in the sprite list). This will be the thing the player tries to reach. Put a "when green flag clicked" block and a "go to random position" block on it, just like the first obstacle. Then click on your main sprite and add code that says "if touching [goal sprite], change score by 1" and "go to random position" (so the goal moves to a new spot each time you touch it).
To display the score on the stage, click "Variables" and drag the "score" block onto the stage. It will appear in the top left corner. Now when you play, you'll see your score go up each time you touch the goal.
Testing and fixing common problems
Click the green flag and play your game. Try to break it: press keys rapidly, move into corners, touch the obstacles. Does your sprite move smoothly? Does it get stuck? Does the score go up? Write down what doesn't work.
If your sprite moves too fast or too slow, change the number in the "move 10 steps" block — higher numbers make it faster. If it's hard to control, add more "if key pressed" blocks for diagonal movement, or use "change x by" and "change y by" instead of "move" so you have separate control over left-right and up-down.
If your sprite goes off the edge of the stage and disappears, click on it and add an "if on edge, bounce" block to the bottom of your forever loop. If the obstacle or goal doesn't move or appears in the same spot every time, check that you used "go to random position" and that it's inside a "when green flag clicked" block, not inside the forever loop.
The most common mistake is forgetting to put code inside the forever loop. If something only happens once and then stops, drag the block inside the forever block. Test again after each change — small fixes often break something else, so test constantly.
Sharing your game and next steps
Once your game works, click "Share" in the top right. This makes your project visible to other Scratch users. You can share the link with friends, or just keep it private if you want to work on it more first.
To improve your game, try adding sound effects (go to "Sound" and drag "play sound [pop]" blocks), changing the background (click the stage in the sprite list, then go to "Backdrops"), or adding more obstacles and goals. You can also add a timer that counts down, or a "lives" variable that goes down when you touch an obstacle.
The skills you've learned here — moving a sprite, detecting collisions, changing variables — are the foundation of every game. Once you're comfortable with these, you can make games that are more complex: games with multiple levels, games where enemies chase you, games with power-ups. Scratch's community has thousands of example projects you can look at and remix to learn new techniques.
Frequently Asked Questions
Can I use my own drawings instead of Scratch's sprites?
Yes. Click the paintbrush icon next to "New sprite" to draw your own sprite, or click the upload icon to use an image file from your computer. Keep drawings simple at first — detailed images can be slow to move around the stage.
What if my sprite gets stuck in a corner or behind an obstacle?
Add an "if on edge, bounce" block to keep your sprite on the stage, or use "if touching [obstacle], move -10 steps" to push your sprite back out when it collides. You can also add "go to [x: 0 y: 0]" to a key press so the player can reset their position.
How do I make my game harder as the player gets better?
Use your score variable to change the game. For example, add a block that says "if score > 5, change [obstacle speed] by 1" so obstacles move faster as you score more points. Or add a second obstacle sprite that only appears after the score reaches a certain number.
Can I add music or background sounds to my game?
Yes. Click the "Sound" tab and click "Choose a sound" to pick from Scratch's library, or upload your own audio file. Drag "play sound [name]" blocks into your code. You can play a sound when the game starts, when you touch something, or on a loop using a forever block.
What should I do if I want to make a more complex game?
Start by remixing other Scratch projects — click "See inside" on any public project to see how it's built. Look for games similar to what you want to make, study the code, and modify it. The Scratch community also has tutorials for specific game types like platformers, maze games, and shooting games.