Game 1 - Day 3
Clicker Update - no tutorial
Today was the start of working on my clicker without any specific tutorial. My first goal I hoped would be simple - create an upgrade for passive generation. Something that can be purchased that increases the resources by 1 every second.
But first it was time for some cleanup. I sectioned off blueprints that I had created using the tutorial and added comments around sections that have different functions. I figured this would be great for me in the long run - since I still don’t fully understand how it all works, the reminders will help drill it into me.
In the above photos you might also notice more variables. I created a few more variables to help the game with expansion while I keep going. I created a variable for the cost of the first upgrade, the idea being I can increase the cost of each upgrade as they are purchased - a scaling system.
The big addition was creating a points per second generator.
So after commenting and understanding how the first upgrade works (which makes clicks stronger by 1, something which I also changed into a variable for power scaling later) I used my knowledge to make a functioning second upgrade.
I then created a flow where every Delta tick the resources go up by the PointsPerSecond variable.
It was now that I remembered that Delta ticks are based frames and not seconds.
Whoops.
After a bit of research I created a custom even to check if the points per second is about 0 every second, and if it it add the points per second to the total points. Maybe the if statement is too much and I’ll remove it in the future.
But for now it works!
Now to address something that I love in clicker games, purchasing more than 1 of a given upgrade at a time.
I started by sketching out the general idea for the flow of the blueprint. I think it makes sense to have a 4 way if statement. One for if it’s 1 purchase, another for it’s 10 purchases, another for 100, and one for when it’s MAX
But before I created that blueprints I realized - I want the shop to be scrollable, at least for now. So I spent a while figuring out a ScrollBox and now - I still have resizing issues to figure out, but when the shop has overflow a scroll appears!
And after a lot of fiddling, it works!….mostly…for now.
Okay back to that blueprints idea.
First I created a visual row of buttons that I want to turn into toggles.
Then I created a basic blueprints series to change the purchase amount and cost. I noticed that I needed a new variable - the price of a single purchase of each upgrade I created that and used it throughout.
I also went back and renamed a variable I had used earlier to Purchase Amount, and had that be a variable set by the toggle.
Next I needed to created the Max toggle using the formula I had written down earlier.
Total Resources ÷ Cost of Resource = Max Amount.
After changing Purchase amount & amount owned variables to be integers (since I only want to have whole amounts of items) I had some strange errors. After a lot of trying different things I found that if I typed the same number again and then recompiled the error went away. We’ll see if this comes back to bite me.
It was while staring at this part of my blueprints I realized I had a solution - go back to purchase amount variables for each upgrade. It was that or do some tick methods I couldn’t quite work out I think. So I went back and changed blueprints yet again.
After some back and forth (and a few infinite loops) I realized I could use a similar system to the points per second to constantly updated the amount that can be purchased. I set the frequency to 0.1 seconds which might be too resource heavy or maybe too slow (for fast clickers). Either way it works for now.
As an added bonus I changed the price text to reference that the max is being purchased.
Tomorrows goal: make the toggle buttons work like a toggle.