How to Make a Maze on Scratch
by NoDripDev in Living > Video Games
709 Views, 1 Favorites, 0 Comments
How to Make a Maze on Scratch
You will be making a maze, using only simple coding blocks and a little bit of your time. Scratch mazes are fun to make and are even more fun to share with your friends.
Supplies
All you need is the internet and scratch!
Size Your Cat
When you first make the project, go to the right bar under the game and make the size of the cat to 50. You can also add a code like: When flag clicked Set size to 50%
Movement of the Cat
This is going to be the movement of the cat’s x-axis. When you start, you want to add a when flag clicked, forever, if left arrow key clicked then, change x by -4. Do the same thing for the right arrow except instead of -4 make it 4.
Movement of the Cat Part 2
For the y-axis, you want to make it so instead of change x by 4 make it change y by 4. You want the if to be in a forever script, then if up arrow key clicked, change y by 4. Do the same thing for down arrow except instead of 4 make it -4.
Make the Cat Be Centered
On this code, move your cat wherever the start of the maze will be. Pull over the when flag clicked block and put the go to x =_ and y=_ block under the flag block so whenever you start you will go to that position.
Make the Maze
The title explains itself. Make another sprite and make the maze. Line up the lines with the scratch cat and then you are done with your maze.
Reset If Touching Maze
You might find that as you are moving the character, it can go through the maze. To fix this, make a block of code. When flag clicked, forever, if touching sprite 2, then go the starting position (the block of code that goes, go to x=_ and y=_) ***MAKE SURE THE CODE IS ON THE CAT***
FINAL STEP
Add another sprite. Move it to the end of your maze. Make a code on the cat that goes like, when flag clicked, forever, if touching sprite three (the end sprite) say You Win)