Not really a beginner but getting back into it, how would i make an autoclicker similar to the one in cookieclicker? I dont just want an upgrade where you buy 2 and it gives you 2 a second, in cookie clicker its kinda like delayed or something? So what make a new timer slightly after every upgrade? Wouldnt that take too much procesing power or something? What do i do?
#Auto-clicker
13 messages · Page 1 of 1 (latest)
I think is pretty much like that. Your upgrades change how many cookies you get per second. So you basically just need 2 variables and a timer to keep track of your cookies.
but i dont really just want it to add 2 cookies a second, in cookie clicker it is adding 1 cookie twice, not 2 cookies once, you get what im saying?
You mean how the numbers ramp up visually?
i guess?
i dont know they kinda seem like they click seperately
right now i just make a new timer everytime its upgraded
You can still update the amount every second but visually update smoothly
like the counter does this instead of just increasing by 2.8 a second
If you want something exactly like cookie clicker, I would use a single timer (0.5s duration), a list [0,0,0,0,0,0,0,0,0,0] and a variable (x = 0).
Every time the timer runs out, add list[x] to your cookie count and add 1 to x. When x gets bigger than list.size(), set x to 0.
And when you buy/get another clicker, add 1 to the first value that's not floor(clickers / list.size()) in the list ([1,0,0,0,0,0,0,0,0,0]).
This should be similar to cookie clicker, where the clickers activate in a circle pattern, while skipping empty spots.
If you want something simpler, where it just adds one cookie at a time at a certain rate (e.g 2.8 per second), just make a single timer with a duration of 1 / cookies per second. Every time it runs out, add a cookie to your total.
what?
Basically, if you pay really close attention in cookie clicker, you can see that the clickers activate in a circular pattern. When you get enough, two will start clicking at once, then three, etc. By looping through a list and adding it's values to your cookie count, you can get a pretty similar effect.