• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

how to purchase single upgrades

C

Callam

Guest
I'm currently developing a mining game. Premise is simple, you have so many moves to collect as much ore as possible then when your out of moves you earn money. Money is spent on upgrades for more digs etc.

I'm working on the upgrade part now. I have the upgrades working, however the problem is with it automatically purchasing multiple upgrades if i have the cash, let me elaborate a bit more. Below is the amount of digs and cost to get that upgrade.

Digs - START
Digs 6 - $200
Digs 7 - $350
Digs 9 - $500
Digs 11 - $675
Digs 13 - $900
Digs 16 - $1150
Digs 19 - $1470
Digs 22 - $2090
Digs 25 - $2780
Digs 28 - MAX

If i have just over the amount of the next upgrade it works, so lets say i want to upgrade to6 digs and i have $225. it will upgrade from 5 digs to 6 digs. But if i havesay $3000 it will buy as many upgrades as possible, so in this scenario approx 5 (upto 13 digs). I dont want this as i want the playr to stragetically choose what upgrades to get.

Here is the process i have at the moment


Any help is appreciated, thanks
 
It's because you need more else statements. Right now it checks if you click once it upgrades then upgrades again because there isn't an else stopping from doing so. You might also need a few more start and end block arrows to ensure you close any loose ends of the code.
 

Roderick

Member
Start at the biggest value. It will keep your code cleaner.
Code:
if value >= 28 do 28 stuff
elif value >= 25 do 25 stuff
elif value >= 22 do 22 stuff
...
 
Top