Scratch Game Development Tutorial For Beginners
Scratch is regarded as one of the best platforms for all age groups to develop…
You will be able to move the cat around by using the arrow keys on your keyboard. You will not be able to go through the maze walls even if you tried. The objective of the game is to get to the very end of the maze. So, lets go into how to create this program step by step. Go ahead and start up the scratch editor by clicking on create. The fist thing you will do is download this maze image. Simply right-click on it, and save it on your computer. You could draw it yourself by painting a new sprite.
Back in the Scratch editor you can upload this image from your computer by clicking on the upload sprite icon from the file. Move the cat out of the way, and adjust the maze imagine to be in the center of the stage. The cat is way too big for this image. You will have to grab the shrink tool and then click several times on the cat to shrink it down. It should look like this. We want the Scratch maze program to move the cat around whenever the player presses on the arrow keys on the keyboard. So, in the brown events category grab ”when green flag clicked” block. Then from the yellow Controls category grab the forever block. This will run through the code that is inside its mouth forever. We want it to check if a arrow key is being held down. Grab the if-then block and from the light blue sensing category grab the key pressed block, and fit it inside the condition socket for that if block. In the drop-down menu choose left arrow key. To actually move the cat sprite, go to the dark blue motion category and grab the ”change x by” block. And since we are changing the x coordinate to go left, we need to have this be a negative number. I say, -4. We could go back and add all those block for other arrow directions, but I am going to make a small shortcut for this Scratch maze. Right click on the ”if-then” block and select duplicate. That will give us a nice duplicate set of all the blocks already. And all you have to do now is change it to ”right arrow” and since we are moving the right direction, change the x by 4, instead of -4. Duplicate the ”if-then” block all over again, and change the last to ”if-then” block to control the up arrow and the down arrow. Also, delete the ”change x by” blocks to ”change them to ”change y by” blocks. They are responsible for the y coordinate movement. For the up arrow direction change it by 4, and for the down direction change it by -4.
Test the program out.
Now to animate the Scratch maze cat, the sprite comes with two different costumes. Click on the costumes tab in the center to see them.
Don’t like my walkthrough? No problem, try this full tutorial walkthrough by a Smart Young Scratch Coding Kid by called Kobe. If you’d like to code like Kobe, my Udemy Scratch Course for Beginners will show you how in easy to understand steps. Use this special code to do the course now for 25% discount!