How to Make a Clicker Game
|Описание||Руководство по созданию игр типа clicker-game|
|Область использования (ISTE)|
|Близкие рецепту понятия|
|Среды и средства для приготовления рецепта:||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
when gf clicked set [Obtainable1 v] to  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  when this sprite clicked change [Obtainable1 v] by (ClickingPower)
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.
First, make 2 costumes, one for entering shop and one for exiting.
when gf clicked set [costume v] to  switch costume to [costume1 v] when this sprite clicked if <(costume)=> then broadcast [shopopen v] next costume set [costume v] to  else broadcast [shopexit v] next costume set [costume v] to  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  set [OPS v] to [0.1] set [BuildingNo.# v] to  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 are very hard to create a tutorial on, as they are triggered by different things which is why this section is so small.
Upgrades are hard to make, but this section will walk you through it.
when gf clicked set [UpgradeCost1 v] to  hide set [hidden v] to  wait until <(BuildingNo. #)=>
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.
Add the following blocks in their corresponding places.
set [hiddenSpecial v] to  //Snap onto the when green flag clicked. set [hiddenSpecial v] to  //Snap onto the end.
Then, add the following script.
when I receive [shopopen v] if <(hiddenSpecial)=> then show end when I receive [shopexit v] hide end
Next, add the following script.
when this sprite clicked if <(Obtainable1)>> 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.