Upgrades problem

i was bored so i decided to remake Everything Upgrade Tree because why not

but then i came across a huge problem!!!
(just a heads up English is NOT my native language, and i have NO CLUE how to explain this properly, if no one understands this i’ll just go figure it out myself or give up)

alright lets say your pretty far into the game now
you’re getting 8k points per second since you’ve unlocked many upgrades
but the x2 upgrade (the first one you bought) is at the beginning so it only doubles at the beginning
point gain goes from 1 → 2
it doesnt x2 the whole time (you get 8k instead of 16k)

so what i want is that everytime you buy an upgrade it also applies to all other upgrades which if i wanted to do manually would probably take me thousands of lines of if/else statements

okay fellow noob bucket hat I’ll help you

You need to, somewhere, store a multiplier variable, and those upgrades can just add to that value.

For example, when you buy the first upgrade, it can add 1 to the multiplier variable, and if the variable started out as 1, that means it’s now 2. The code which adds the points onto your character can just multiply by this number, and upgrades can just add onto this number.

So that later down the line, let’s say there’s a 10x multiplier upgrade, well it can just add 10 to that variable. No fuss needed.

1 Like