Minecraft on Scratch.
Here you will learn about Minecraft on Scratch.
Table of Contents
In this article I will explain you how to create Minecraft on Scratch. First thing you do is go to the costume tab, make sure it is bitmap mode. Get the line tool out, go to black, and make sure it is pretty thick. Create a rectangle from the right bottom corner, that resembles the hand of the Minecraft character. Divide the end of the rectangle to make a cube, and then color these two parts to make it look like hand. So, before we get on to making any new sprites, first you need to go the the script tab. You need to add some code for the keyboard button. Add one when green flag block, go to control category and add one forever block. Then head to the sensing category and get the key press block, and set it to if key right is pressed. Drag the broadcast block from the Event category. Duplicate so that you have this script for 4 different keys. Set it for all the keys, up,down, left and right. And in the broadcast message set message to be appropriate to the key pressed. For left, choose to broadcast block to broadcast message left. Do this for all broadcast blocks.
I recommend you taking the Scratch Programming online course, which will help you learn how to make games and animations in Scratch programming language. 25% OFF!
Create your first MInecraft game on Scratch.
Now, create a new sprite. Paint a simple model of a tree, using brown and green color. Use the rectangle tool for shape drawing. Then add script for it. Add one event block to start the script when the green flag is clicked. Then go to looks category and one show bock, one clear graphic effect and one set size to 100% block. Go to motion category, and drag one go to block under this script, and set it 25 for x and 0 for y axis. Now add one When I receive block, and in the drop-down menu choose down. Then add one change size block from the looks category, and set it to -1. Then duplicate this script, and in the drop-down menu choose up key, and set the change size to 1. Add two more when I receive blocks and set one to left, and the other to right. From to looks category add one change x by block to each of these two scripts. Set the right one to negative 3, and the left one to 3. Have a test of this program. You can move around and the effect will look just like in the real game, but this is Minecraft on Scratch.
Now I am going to show you how to add a landscape. Go to backdrops, click on the paint icon and make a very basic landscape filling half of the canvas with green color. Also, to add the cross-pointer in the middle of the stage for precise actions, make a new sprite and simply paint a cross in the middle of canvas, preferably in black color. Then add script to it. Start by placing one when green flag clicked block, and from the motion category add one go to bloc, and set the coordinates to 0 and 0. From the looks category add the go to front block, because it has to be in front of everything. Test the Minecraft on Scratch. It looks really cool, you can zoom in and out now.
In Minecraft you can break blocks. Now we are going to add the same aspect in this Minecraft on Scratch. Add one ‘when green flag clicked’ block. Then go to control category, and add one forever loop block. Inside it add one if-then block. Now we are going to make a couple of statements. Drag two ‘and’ blocks from the operator category, and place them all inside the ‘if-then’ condition window. In the first and window add one ‘greater than’ operators block. Then go to sensing category and add one ‘key pressed’ block inside the second ‘and’ window. And add one ‘touching’ block inside the last operator block window. In the drop-down menu choose Sprite 3, which is the cross pointer for the game. Now, it is not possible to break something from a great distance. Therefor, go to the looks category and add one ‘size’ block inside inside the ‘greater than’ statement. Now set to size greater than 190. When the above condition is true, the ‘if-then’ block will runs the script inside its mouth. Inside it add one ‘change effect by” block from the looks category, and set it to ghost effect. The way this block works is that if you increase the number in it, the stronger the effect will be.
Test the game.
Test the script. It is very cool, you can now break objects in this game. To add new things, simply copy the sprite 2 and change its costume. For example, we can add a house. This object will have the same script as the sprite 2, and that is a problem. We have to change its spawning position by changing the ‘go to’ coordinates to something different than the tree. The y axis value can remain close to the original, but you have to change the x coordinate value to make it look like it is adjacent to the tree