If you're looking to create your first game using Scratch, I highly recommend making a maze.
Why? Because you can create something simple yet fun without having to use any complicated blocks. It's a great way to get familiar with the basics of Scratch.
Our goal: "Let's build a maze!"
Here's what we're aiming to create with our Scratch project:
Remix the Starter Project
For this tutorial, there's a starter project you can remix. It's handy because it comes with all the necessary costumes and more. Of course, you're free to start from scratch if you prefer.
Make it Move
First, we'll code so that pressing the arrow keys moves the player.
The basic idea is to assign a condition block that says "when the up arrow key is pressed," and within that, place a block that moves the character 2 steps.
Let's give it a try!
Getting Ready to Start
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-31-24_en-1.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-32-30_en-1.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-33-2_en-1.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-33-49_en-1.png)
Create a Loop to Receive Key Inputs
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-34-20_en-1.png)
Check the Up Arrow Key
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-34-54_en-1.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-35-28_en-1.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-36-3_en-1.png)
Check the Down Arrow Key
Copy all the blocks from the up arrow key condition and paste them right below. Right-clicking will show a menu where you can select "duplicate" for convenience.
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-37-59_en-1.png)
Check the Left Arrow Key
This time, instead of moving, let's make the player rotate.
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-38-43_en-1.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-39-13_en-1.png)
Check the Right Arrow Key
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-39-54_en-1.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-40-29_en-1.png)
Test if the Movement Works
Code to Return to the Start When Hitting a Wall
Instead of ending the game when the player hits a wall, let's make them return to the start.
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-44-16_en-1.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-44-52_en-1.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-45-32_en-1.png)
Test if Hitting the Wall Works
Code to Advance to the Next Level Upon Reaching the Goal
Wouldn't it be fun to have lots of maze levels?
Try coding so that reaching the exit advances to the next level.
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-47-29_en.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-48-2_en.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-51-10_en.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-51-31_en.png)
Create the Variable "Level"
Let's create a variable named "Level." Make sure it's for all sprites.
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-52-3_en.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-52-32_en.png)
Automatically Switch Costumes
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-52-56_en.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-53-44_en.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-54-6_en.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-54-26_en-1024x344.png)
Open the "Player" Sprite
We'll code what's needed so the player advances to the next level when touching the edge of the screen.
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-55-53_en.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-56-34_en.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-57-15_en.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-57-50_en-1024x537.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-58-19_en.png)
![](https://en.scratch.coach/wp-content/uploads/sites/2/2024/03/2024-3-14-19-58-46_en.png)
Play the Scratch Maze Game!
Now you've got a fully functional maze.
Next, try increasing the number of mazes. Just draw your favorite mazes as costumes, naming them like "Maze3," and you're set.
What kind of maze will you create?
It could be a complex one that keeps you lost for minutes, or maybe add some tricks for an interesting twist.
Once you've created your maze, let me know!
![このスクラッチゲームの作り方への質問もOK](https://en.scratch.coach/wp-content/uploads/sites/2/2023/05/62ebffdc3cb9d19076c5f2b474cfe796-e1684886861241.png)
質問テンプレート(素早く3回クリックすると全選択できるのでコピーしよう)
・◯◯ ... 記事のどこまで実装が終わったのかを記入しよう。・□□ ... どんな問題が起きているのか、どういうときに起きるのか、具体的に書こう。
・共有済みURL ... たまに共有してない作品URLを書いてる人がいるけど、共有しないとこちらから確認できないからよろしくね。