Building Clicker/Idle Games

14

Index

Attached Files

The following files have been attached to this tutorial:

.c3p

basic-clicker-game.c3p

Download now 83.37 KB
.c3p

polished-clicker-game-v2.c3p

Download now 196.33 KB

Stats

9,333 visits, 20,480 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

.C3P

basic-clicker-game.c3p

Download now 83.37 KB
Subscribe to Construct videos now

This example of a clicker game uses global variables to track taps and multipliers as the player aims to make as much money as possible.

The ‘score’ is tracked using the global number Currency and over time the game adds TapNumber (which is the amount of currency received either per second or per tap on the device screen) multiplied by the Multiplier variable to keep the currency increasing.

Player’s can then use this currency to upgrade the products which then increase the amount of currency earned and the cycle continues.

The products are simple sprites which have instance variables to track their current level and their passive and active earning totals. The passive earning count is how much just having the product contributes to the TapNumber variable, whereas the active earning count is how much currency is added every time the player taps the specific product.

Once the player has amassed enough currency, an upgrade button for a product will become visible on the screen. When pressed, the relevant amount of currency is removed from the player’s total and the product’s level increases by one. Their passive and active earning values are set accordingly. The same upgrade button system is used to allow the player to purchase extra multipliers which increase the Multiplier global variable, thus allowing them to earn more currency.

A key feature of a clicker game is the ability to earn currency while the app is suspended. This is relatively easy to set up using the unixtime expression. Unixtime is a standard representation of time on a lot of systems and it’s the current time in milliseconds since January 1st 1970. By recording the unixtime when the game is suspended and reopened, we can calculate the difference, turn that into seconds and then award the player the appropriate amount of currency depending on how much time has passed.

The final feature in the basic clicker game is the ability to save progress. The project simply uses Construct’s inbuilt save game system, creating a new save every ten seconds, though realistically in a real game this probably isn’t frequent enough. The project contains a Boolean which tells the game whether it’s been loaded before. If the Boolean is false, the game has previously been loaded on the device and the save data is then loaded. Note if you’re building this game yourself, it’s best to implement savegames last or disable them once you’ve confirmed they work – if you’re saving and then make changes to the layout for example, the new layout won’t be loaded as it’s not present in the save data!

  • 2 Comments

  • Order by
Want to leave a comment? Login or Register an account!