Designing a Game Using Scratch 3.0
Designing a Game Using Scratch 3.0
Scratch 3.0 :What if you want to create a game with coding but you don’t know where to start? Some questions you may have are “What software do I use?” and “How do I learn to use the software?”. In this blog post, we answer all these questions and more, getting you coding in no time,with Scratch 3.0 Software。
Downloading Scratch 3.0 Software
When downloading a coding software Scratch 3.0 , you need to think about what language you want to learn. There is a plethora of coding languages that are out there but the most popular languages include Python, Java, C++, and Swift. These languages are all hard to pick up and learn on your own, but luckily, we have a solution to that problem——Scratch 3.0, Makeblock’s mBlock software. Based on MIT’s Scratch language, Scratch 3.0 allows you to easily dive into the realm of coding by representing code graphically in an intuitive way and allowing Python switching with one click. What does this mean? Well, take a look at Scratch 3.0.
Using mBlock to apply Scratch 3.0
After having a basic knolwedge of Scratch 3.0, let's say hello to the new mBlock 5 interface! You can download this here.
This might look confusing at first, but it is very simple to understand and pick up.
On the left side (red) we have what is called the Stage. This is where you can see the outcome of what your code does and also access your devices, sprites, and backgrounds. Having the Stage there is very useful because you will be able to see how your game changes when you change the code.
In the middle (green) we have the Blocks. As you can see, there are many different color categories, such as motion, looks, sound, and pen. All these categories contain preset code blocks that you can drag and drop onto the right side (Script).
Finally, we have the right side (blue) or the Script area. This is where you place your code to make your game. Anything that goes on this area affects the Stage.
Learning How to Code Games by Scratch 3.0 and mBlock 5
With mBlock 5’s versatility in options, the number of games you can come up with are endless!
Let’s start off by showing you how to get code onto the script. Simply select the blocks you need from the Blocks area, left click the block and hold it, then drag the block to the Script area and drop it.
All these categories on the side give you different options to craft your game into what you want it to be. As you can see from the “Events” blocks above, all of them have little connectors on the bottom of the block (like a puzzle piece) which can be used to connect to a function block#Scratch 3.0# .
Using the code pattern shown above exhibits a result that you can easily see on the “Stage”.
This panda is a sprite. Sprites are actors in the program, sort of like video game characters. To add new sprites, click the sprites tab and then hit the plus sign.
You can also add stuff like AI and Music by clicking on the plus below the “My Blocks” category in the middle of the screen if you want to make your game more advanced!
Guided Example: Maze Starter by Scratch 3.0
Now that you know about coding in mBlock 5, let’s look at an example of a game that you can code by yourself!
If you click this link, it will take you to a game called “Maze Starter”. This is a very simple game where you use your arrow keys to control a ball through a maze to the end goal.
The interface will look different from mBlock 5’s because this is the Scratch 3.0 version of the program. Click the top right arrows labeled “See inside” to see all the blocks of code that were used to make the game.
On the bottom left (red) there are two sections, Backdrops and Sprites. Backdrops are objects that make up the environment in your game. Sprites, on the other hand, are objects that either move or perform a given function.
Scripts, Backdrops/Costumes, and Sounds are found at the top of the center of the screen (green).
Clicking Scripts gives you many sub categories such as motion, looks, or control that you can click for your desired effect. Each of these sub categories provide a set of template codes that you can simply drag and drop onto the Script Area of the screen.
Backdrops and Costumes lets you design your sprites and backdrops using shapes and colors.
Sounds provide you audio for your game that you can use.
Use Scratch 3.0 to Code the Maze Starter
Now that we are familiar with what we are looking at, let’s look at some code in the script area. Simply select the Ball sprite and the “Motion” sub-category in the Script tab to see what code goes into moving this object.
Your script window should now look like this:
The orange-brownish color denotes the “when” clause which basically means that when something happens, the ball will do something. So the first code in a sentence would be, when the green flag is clicked on the top left of the game screen, the ball will be placed at coordinate (-205, 147). Similarly, when the up arrow is pressed on your keyboard, the ball moves north 10 steps.
Look through the other code for this ball sprite to learn more about what goes into making this game. Coding in this interface is like making sentences – very intuitive.
Enjoyed yourselves with Scratch 3.0
After you have a good feeling for how this game was coded, it’s time to create your own game! Hop into mBlock 5 and either make another maze game or trying shooting for something else you came up with. The more you code, the better and faster you will be at it. And when you are ready to take your coding skills to the next step, simply click on the language tab on the top of your interface and select Python! And it’s as easy as that. Through examining someone else’s code, we’ve learned to code our own games. There are plenty more coded games on Scratch 3.0’s website that you can check out. Just get out there and start learning!