This is the most fun cookie clicker on Scratch!

Read this article to learn how to make cookie clicker on Scratch. It is a rather complex game, as it involves a couple of variables to be created, and some of them are inter-winded with variable data blocks. If you are new to this, I recommend you taking my online course that will teach you how to program in Scratch programming language. Click on this link the receive 25% OFF. https://www.udemy.com/scratch-programming/?couponCode=SPECIAL

Cookie clicker on scratch. Alright, lets start by opening a new scratch project, either online or offline, it does not matter. I have provided all the necessary sprites in this article too, simply right click on them and save them on your computer. They are taken from the Pixbay. Now, delete the cat sprite. Then upload the cookie sprite and the smiley face sprite, which will be the cookie baker of this program. Next click on the backdrop and go to its costume tab. Divide the screen in 4 parts, where the two upper quadrants are slightly larger than the bottom ones. Also, apply some bucket coloring to achieve a nice background theme color. Next click on the cookie sprite. I am going to add a program to the cookie sprite.

Two main sprites.

Cookie clicker on scratch. Cookie clicker on scratch. Start by adding the ‘when flag clicked’ event block. Next click on the data category and make two variables. One is going to be called ‘cookie’, and the other will be called ‘cookies per second’. Add two ‘set’ data blocks under the event block, and set them to 0. Make sure that in the drop down window one is cookie, and the other is cookies per second. Then click on the operators category and add the ‘forever’ loop block under it. Inside it place the ‘wait 1 second’ block, and the ‘change cookies by’ block. Inside it, specify that the cookies should change by ‘cookies per second’ variable block. Simply drag the block inside. Awesome! This script will set the cookie counters to 0 when the game starts. The forever loop will be responsible for adding extra cookies when the player buys a baker, that autonomously adds cookies. Adjust the cookie inside the left upper quadrant. We are almost half way done through this cookie clicker on Scratch.

Cookie clicker on scratch. Alright, the next block to add is the ‘when this sprite clicked’ event block. This block will run script under it when the cookie sprite is clicked on. Now, when we click on it, we want it to ‘change size by -10’. This block can be found in the looks category. Then add the ‘change cookies by 1’ block, to increase the amount of collected cookies by 1 every time we click on the cookie. Then from the control category add the ‘wait 1 second’ block and change it to 0.000.1, and then add the ‘set size to 100%’ looks block. This script will give a nice animation of cookie being clicked upon. Finally, when we click it, make it broadcast a message that says – clicked. This will be received by other sprites and a certain script will be run because of it. Next I am going to make a program for the baker smiley face, that will provide an option to buy a autonomous baker. A very fun addition for this project.

Add the main baker in this cookie clicker on Scratch game.

Cookie clicker on scratch. Start by adjust the smiley face inside the first quadrant. Leave a substantial place for the ‘click to buy a baker’ and the ‘cost: 50 cookie’ text under it. In the scripts area, add the ‘when flag clicked’ event block. Then make a new variable, and name it ‘bakers’. Add the ‘set bakers to 0’ data block under the event block. This will simply reset the amount of bakers when the game starts. Next add the ‘when this sprite clicked’ block. Under it add the ‘if then’ statement block. Inside its conditional window add the ‘greater than’ operators block. Inside it place the ‘cookies’ variable block and write 49 in the other window. This operators block will run blocks inside it mouth when this condition is true, when the amount of cookies is over 49. Now, lets set what will happen when we click on the smiley face. First, add the ‘change cookies by 0’ data block and set it to 50. This will subtract 50 cookies from the main cookie bank. Then add the ‘change Bakers by 0’ and set it to 1. The player will receive a baker. And finally ‘change cookies per second by 1’. This will increase the amount of cookies the player receives, every second. Very good. Next click on the ‘paint new sprite’ and use the text tool to write ‘+1’. This sprite will be used to make an animation of cookies being added when we click on the cookie. Place it right next to the cookie sprite. Now I am going to write a program for it. We are 50% through the cookie clicker on Scratch.

Cookie clicker on scratch. Add the ‘when flag clicked’ block, and under it place the ‘hide’ looks block. This will hide it when we start the game. Next, add the ‘when I receive clicked’ event block. This block will run blocks under it when the broadcast block broadcasts the ‘clicked’ message. Go to looks category and add the ‘set ghost effect to -100’. Next add the ‘show’ block. This will set the sprite to be completely invisible and the ‘show’ block allows us to make it visible again. Under it add the ‘repeat 10’ times control block. Inside it place the ‘change ghost effect by 10’. This will make it become gradually visible, and it will ghost away soon after. It is simply a cool animation effect for this game. Next make 3 separate sprites, and each is going to be a text. The first one will say ‘Click to buy a baker! Cost: 50 cookies. Use the text tool to write it, and then adjust it under the smiley baker face. The next one should say ‘Bakers:’ and after one line break ‘Cookies per second’. Position it in the 4th quadrant. And the third text sprite should say ‘Cookies’, and place it in the 3rd quadrant. Finally right click on the variable boxes on the screen and set them all to have a ‘large readout’, and adjust them on the stage where appropriate. I hope you enjoyed this awesome pocket size cookie clicker on Scratch.

Written by admin

Leave a Comment

Your email address will not be published. Required fields are marked *