UnicMinds

Coding Cookie Clicker Game

A Simple Cookie Clicker Game in Scratch

The user starts with clicking a cookie on the screen and the user earns dollars. Keep clicking the cookie to earn the maximum amount within stipulated time.

Step 1: Creating Background for the Game

Click on the choose a backdrop option on the bottom right corner as shown below:

Coding Cookie Clicker Game

It will open backdrop options as shown below. Click on Blue Sky 2 to get the backdrop.

Cookie Clicker Background
Cookie Clicker Game Background

Click on the text ‘T’ to add a text on the backdrop and type $ in the textbox in the backdrop.

Cookie Clicker Game Backdrop

Step 2: Creating Sprites for the Game

Uploading Sprites - Cookie Clicker Game

Click on the upload sprite option on the bottom right corner. Choose any cookie picture that you can download from the internet.

Cookie & Cookie Particles

Click on the add sprite as highlighted below and upload a cookie particle picture downloaded from the internet.

Cookie Particles

Step 3: Making the cookie bigger when clicked 

Add the below code for the cookie sprite.

It checks whether the mouse is clicked on the cookie using the touching block. If  the mouse is clicked on the cookie, the value is 1 otherwise the value is 0. If a cookie clicked, the size of the cookie changes by 50, otherwise it stays the same size of 350 pixels.

Cookie Clicker - Making the cookie big when clicked

Step 4: Creating different variables for the game

Create the following variables for the game:

Score variable to keep track of the clicks on the cookie.

Particlex to store the x position of the cookie particle

Particley  store the y position of the cookie particle

Variables - Cookie Clicker Game

Step 5: Increasing the Amount of Dollars when the cookie is clicked 

Add the below code for the cookie.

When the cookie is clicked, the score is increased by 1 showing the increase in the amount of dollars by 1 $.

It creates clone of the cookie every time the cookie is clicked.

Amount of Dollars - Cookie Clicker

Step 6: Creating cookie particle when cookie is clicked 

Whenever the cookie clone is created, the costume is changed to a cookie particle. The x and y position of the cookie particle is randomly chosen by the computer.

Then the y position of the cookie particle is 

Cookie particle when clicked

Hope this is useful to provide a simple start to the Cookie Clicker Game, thank you.

You may like to read: C Programming for Kids, Inspiring Kids to Learn Coding, & Coding for Kids

Leave a Comment

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

BOOK A FREE TRIAL