Need help with clicker game!

D

Doooooli

Guest
Let's say i have an shop object called like obj_square!
And my currency for the game is clicks!

So when i buy the obj_square i want clicks to increase with +1 for each seconds, how would i do that?
And then let's say i have an item called obj_triangle, and when i buy it it will increase my cps (clicks per second)
So when i press my money income item i will both get +1 clicks each second and 2 clicks for each time i'm clicking it! How would i do that easy and fast?

thx :)
 
W

whale_cancer

Guest
The object that increases your clicks (let's say obj_square) needs an alarm event. Whenever that alarm triggers, you would increases your clicks (so global.clicks += 1 or global.clicks = global.clicks + 1).

You need to have a countdown for your alarm, so in the objects create event set it to alarm[0] = room_speed * 5 (if you wanted the countdown to be 5 seconds, for instance).

Also add that code to the end of your alarm event so that once your alarm triggers, it starts the countdown again.
 
D

Doooooli

Guest
The object that increases your clicks (let's say obj_square) needs an alarm event. Whenever that alarm triggers, you would increases your clicks (so global.clicks += 1 or global.clicks = global.clicks + 1).

You need to have a countdown for your alarm, so in the objects create event set it to alarm[0] = room_speed * 5 (if you wanted the countdown to be 5 seconds, for instance).

Also add that code to the end of your alarm event so that once your alarm triggers, it starts the countdown again.
Okay thanks! Now another question, how would i fix so the price for obj_square increased by a certain amount for each time i buy it? :) thx!
 
W

whale_cancer

Guest
Okay thanks! Now another question, how would i fix so the price for obj_square increased by a certain amount for each time i buy it? :) thx!
There are a lot of ways to do it and it also depends on how you are buying it. Are you buying it by clicking on a button? If so, just have that button increment the price every time you buy it.

So in your create event for the button you can set 'price' to 10 or whatever.

Then on the click event, subtract the price from the global.clicks.

Then add whatever number you want to the price to increase it for next time.
 
D

Doooooli

Guest
There are a lot of ways to do it and it also depends on how you are buying it. Are you buying it by clicking on a button? If so, just have that button increment the price every time you buy it.

So in your create event for the button you can set 'price' to 10 or whatever.

Then on the click event, subtract the price from the global.clicks.

Then add whatever number you want to the price to increase it for next time.
I'm buying it by pressing the obj_square! So it works now, when i press the square i loose 10 clicks and gain 1 per second! But when i go back to the main room it does not work! And i can't make the obj_square persistant since i don't want it to be in the same room as the game!
 
W

whale_cancer

Guest
I'm buying it by pressing the obj_square! So it works now, when i press the square i loose 10 clicks and gain 1 per second! But when i go back to the main room it does not work! And i can't make the obj_square persistant since i don't want it to be in the same room as the game!
Instead of having price a variable local to your object, you can just make it a global variable (i.e. global.obj_square_price)
 

NightFrost

Member
To get a bit more authentic clicker game feel, you should calculate what the increase to your score is per step. That way the score will appear to be increasing constantly. Also, you will run out of real number space very quickly, you should create a system for saving big numbers that is based on arrays.
 
Top