Make Games On Scratch Library
Libraries in Scratch are defined sections in the respective project editors. Here, the users have…
This survival game article teaches you how to create an epic ice vs fire evasion game. If you are new to this – I recommend you taking my online course where I teach how to fully use the Scratch editor and how to program games, animation and art.
Alright, lets start creating the game. First, change the background to a simple color. In my game I have used the purple backdrop. Then upload the ice cube and the fireball sprite I have provided in this article Right click on it and save it on your computer. Then click on the sprite upload icon, and upload them to the Scratch editor. Lets start making a script for this evasion game on Scratch to control the ice cube. Add one ”when flag clicked” block to the scripts area. Then go to the looks category and add the ‘set size to 100%’ block. This will make the cube start in its default size. Now add the ‘forever’ loop. Inside it place the ‘go to x: coordinates y:coordinates’ from the motion category. Set the x coordinates to ‘-207’. This will make the sprite remain on the left side at all times. To be able to move its up and down position, go to the sensing category. Add the ‘mouse y’ block inside the ‘y: coordinates’ window. This will allow us to change its y axis position by moving the mouse up and down. Now add the ‘if then’ block, and inside the condition window add the ‘touching fireball’ block. Now, when the ice cub is touching the fireball, then ‘change size by -5’. This block can be found in the looks category. Alright, test the program to see if you are able to control the ice cubes vertical movement. You should be, if not, check my script and make sure it is the same as yours to make sure you are programming this evasion game correctly. Next I am going to script the fireball, to make it duplicate itself and fly at the ice cube, making this into an evasion game. Click on the fireball sprite. Start by adding the ‘when flag clicked’ block. Then add the ‘forever’ block, and inside it drag one ‘wait 1 secs’ and one ‘create clone of myself’ blocks. From the operators category add the ‘pick random’ block, and sets its integer range from 0.25 to 1. What this script does is that it endlessly creates fireball clones. It can happen within the specified time interval we denoted in the ‘wait’ block. Now, add the ‘when I start as a clone’ block. This block executes script under it when the fireball creates a clone of itself. The evasion game on Scratch is coming to life!
We want it to go to the far right side, therefore, add the ‘go to x: y:’ motion block. Set it to 200 for x axis, and the height will be picked randomly. Add the ‘pick random’ block inside the y axis, and set the range from -180 to 180. Now you need to add the ‘repeat until’ condition block. This block repeats scripts inside it until the condition in the window is true. And that condition will be ‘touching edge’. This block is located in the sensing category. From the motion category, add the ‘change x by 10’ block inside it, and change it to -15. This will make the fireball move to left side until it hits the edge of the screen. And when it does hit it, it will be deleted by the ‘delete this clone’ block from the operators category. Awesome! You have created evasion game on Scratch. You can make all kinds of twists to it, remixing as you wish. I have made an extended version of this particular evasion game on the scratch website. It has an added ‘game over’ end screen and a high-score count to see, for how long do you last in the game https://scratch.mit.edu/projects/158143145/