Coding a Maze Game With Scratch
by 3Designer game in Teachers > 7
864 Views, 3 Favorites, 0 Comments
Coding a Maze Game With Scratch
In this project, we are going to make a game on scratch, a programming software that is quite easy to use.
In general, maze games are quite easy to play and perform on scratch, but in this game, we will increase the level.
You may discover new things on scratch.
In this game too, it's not the character that we're going to move, but the labyrinth, it will still give the impression that it's the character who is moving.
We're going to be using messages a lot so sprites can communicate with each other, so get used to it and name your messages well so you don't get lost or confused.
You can click on this link , if you want to see the game.
Or by looking for Rurualh on the scratch search bar.
Thanks for watching this project and happy viewing!
Supplies
For this project, we will use the scratch software and I put the images that we will use, at the bottom of this text, apart from the person that we will use who is already in the software that I will not give below .
I also put the music that we are going to use.
Put the Costumes in the Right Order
So, here is Tatiana's costume that you can take directly in sprite ,you don't need to reorder the costumes, and for the costume that will serve as our background, you can put it in the order as in the image, the order of which you are going to put them will change the code you will need to code.
For the other sprites, you don't need to put them in order because there is only one costume for the other sprites.
The names of the costumes could also change your codes.
Menu and Put Them in Their Places
We'll start with the menu.
We are going to use the costume number to tell the sprites which should appear when we are on the menu and which should hide when we are no longer in the menu, so here, costume number 5 is the menu costume where there is the word LEVEL.
As for these three sprites which must appear when we are on the menu and which must hide when we are no longer there.
Go to Difficulties Clicked
We will now take care of the Home button.
We're going to put it in its place and put it in the foreground so that the other sprites don't hide it.
We are also going to add a size effect so that it grows a little when the mouse is over the sprite, we are also going to add this effect to the sprites that allow you to choose the level.
We'll also send a message that will toggle to the menu costume, in the sprite we're using as our background, if that sprite is clicked.
Now we'll put the level sprites in place, we'll also add a size effect.
A message will also be sent by all three if they are clicked.
Finally, we will code what will happen when we receive these messages.
The repere costume allows you to enlarge the sprite even more than you normally can.
And for each message, we will switch to the corresponding costume, the custom position for each costume allows to put them in the starting position and the custom size allows to have the walls and the corridors of approximately the same size for the three labyrinths.
Displacement
Now, we are going to code the movement, as it is the maze that we are going to move, we are going to put the opposite of the numbers that we would have put if it was the character that we would have moved. This will give the impression that the character is moving.
So that we don't cross the walls, we are going to send a message each time we move to check that we are not crossing the walls, and if the character touches the wall, it sends another message to say that we have to step back.
The extra steps you take to back up allow you to put a tremor effect to attract the player's attention, so that he realizes that he is bumping into the wall.
Arrived
As the goal of the game is to arrive at the finish line and as there, for the finish line, I marked it with a green line, so we are going to make the character repeat indefinitely: if she touches the line green, it sends a message to say that we have succeeded.
When we receive the message, for the labyrinth, we will have it set to 100% of its size, ie its normal size, for aesthetics.
Then, we will display the text ''You succeeded'', we will adjust its positioning and its size, we will play the win sound and we will add a size effect.
Character Looks
Now we are going to make the character take steps, don't forget to put a little waiting time after each change of step so that he does not change steps too quickly and so that we can see that he is doing footsteps.
We will also determine when he should show himself and when he should hide.
Finally, we are going to repeat music that is already on scratch and that we are going to play for the duration of the game.
Don't hesitate to go see the game on scratch, You just have to click on this link which will lead you directly to the game on scratch.
We have now completed this project, feel free to improve yours.
Thanks for looking at this project and thanks to Instructable for these contests.
Video
On this video, there is no sound like in the game, so if you want to see what it really gives, I advise you to go see the game.
THANKS and bye.