How to Make a Clicker Game

Материал из Поле цифровой дидактики
Описание Руководство по созданию игр типа clicker-game
Область знаний Информатика
Область использования (ISTE)
Возрастная категория 12


Поясняющее видео
Близкие рецепту понятия
Среды и средства для приготовления рецепта: Scratch

Idle games, also called clicker games or clicking games, are video games of which the gameplay consists of the player performing simple actions (such as clicking on the screen) repeatedly to gain currency. This can be used to obtain items or abilities that increase the rate at which currency increases.

Instructions for Creation

Clickables

First, the project will need a clickable. It can easily be made by first picking a costume, and then creating the following script.

when gf clicked
set [Obtainable1 v] to [0]

when this sprite clicked
change [Obtainable1 v] by (1)

However, there is a flaw within that script. If a building or upgrade to make the clicking power increase was created, the previous script wouldn't work.

when gf clicked
set [ClickingPower v] to [1]

when this sprite clicked
change [Obtainable1 v] by (ClickingPower)

Buildings

In order to make the buildings, a decision must be made. The buildings could be shown next to the clickable or they could be shown after using a button. For the button, see Button Section.

Button Section

First, make 2 costumes, one for entering shop and one for exiting.

when gf clicked
set [costume v] to [1]
switch costume to [costume1 v]

when this sprite clicked
if <(costume)=[1]> then
broadcast [shopopen v]
next costume
set [costume v] to [2]
else
broadcast [shopexit v]
next costume
set [costume v] to [1]
end

Now the shop button works.

Continuing Buildings Section

Create a cost variable, a sprite for the building, and a variable for the number of that building the user owns.

when gf clicked
set [Cost v] to [15]
set [OPS v] to [0.1]
set [BuildingNo.# v] to [0]
forever
change [Obtainable1 v] by ((OPS)*(BuildingNo.#))
end

when this sprite clicked
if <(Obtainable1)>((Cost)-(1))> then
change [Obtainable1 v] by (-15)
change [Cost v] by ((Cost)*(1.15))
change [BuildingNo.# v] by (1)
end

Button Section Continued

Add the following script to the buildings.

when gf clicked
hide

when I receive [shopopen v]
show

when I receive [shopexit v]
hide

Achievements

Achievements are very hard to create a tutorial on, as they are triggered by different things which is why this section is so small.

Upgrades

Upgrades are hard to make, but this section will walk you through it.

when gf clicked
set [UpgradeCost1 v] to [100]
hide
set [hidden v] to [1]
wait until <(BuildingNo. #)=[1]>

It is easy to notice that this section is unfinished. That is because if a button is made, the Button section should also be seen.

Button Section

Add the following blocks in their corresponding places.

set [hiddenSpecial v] to [0] //Snap onto the when green flag clicked.

set [hiddenSpecial v] to [1] //Snap onto the end.

Then, add the following script.

when I receive [shopopen v]
if <(hiddenSpecial)=[1]> then
show
end

when I receive [shopexit v]
hide
end

Upgrades Continued

Next, add the following script.

when this sprite clicked
if <(Obtainable1)>[99]> then
change [Obtainable1 v] by (-100)
set [OPS v] to ((OPS)*(2))
end

Use of Cloud Variables

Cloud Variables can be used to count the global total number of clicks. They can also be used to save high scores on the server.