Cookie Clicker Coding Inquiry
motorcycle boy
Member Posts: 429
I have a cookie clicker template from gsinvention.com that I've been changing up a bit. I added a "points over time" with out tapping and have a display on the scene to show how many points the game player is currently getting. For this display though, when the game player taps and gets points per tap, I want those points to also be added into the "points over time." So the points over time display would show how many points you are getting per tap as well as over time added together. Hope that makes sense. I just don't know how to code that just yet.
Comments
When Mouse Button is Down
Change Attribute game.pointsPerTap to game.pointsPerTap+1
Change Attribute game.pointsOverTime to pointsOverTime+1
In other words, you're just adding the same number of points to both attributes when the mouse is clicked.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thanks a lot @tatiang !
@tatiang I just tried that but actually it's not the problem I had. Let's say the points over time is 100. I want the speed that I'm tapping to reflect on that attribute. So if I'm tapping 29 points per second then the points over time would show at 129 per second. When I stop tapping it would gradually or quickly go back to 100 points over time or per second. My tapping would inflate it only while I was tapping in other words. Where as the points per tap is just going up and never goes down unless I spend something. But I don't want the points over time to add a point every time I tap like it does for the main points. It's like if you revved up an engine and the RPM went really high but when you let off the gas the RPM lowers to the current idle of the car. Hope that makes sense.
I would have thought that would be part of any Cookie Clicker clone template.
Here's how I'd start to calculate clicks per second (it's not perfect).
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I don't know if this template has that feature but you might check it out: http://www.deepbluemarket.com/product/even-more-awesome-cookie-clicker-template.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I actually have that template but it doesn't have what I'm talking about coded in. @BigDave has this feature in his cookie clicker games. The second displayed number will elevate the faster you tap and then go back down to it's "idle" speed when not tapped. But the template you posted here isn't doing what I'm talking about. I guess I'm not explaining it correctly. If you download his game "Orcs" you will see what I'm talking about.
I wasn't intending the demo I made to do everything you asked... it's just a starting point. I haven't even thought through how to do that sort of cooldown.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I find this works best for cooldowns.
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
Here is a way to modify points per tap -- based upon tap rate.
Note: Tap fast and furious. You gotta get the points per tap to exceed 1.5 before you notice an increase. (Its taking advantage of rounding error for integers.)