Right, I have a simple class for any upgrade the player can get, including an array containing the cost of each upgrade level, so my initialization looks like:
myUpgrade.description="some description here";
myUpgrade.maxUpgrade=10;
myUpgrade.upgradeCostArray[0]=100;
myUpgrade.upgradeCostArray[1]=230;
myUpgrade.upgradeCostArray[2]=233;
.
.
myUpgrade.upgradeCostArray[9]=12233;
As you can see this doesn't look too good- I have a predefined size 10 int array in my class, AND if any value in the array that is below maxUpgrade is not initialized it will only show up during runtime. Is there a cleaner way of doing this, perhaps somehow with a constructor?
Loading

VulpesRank #55 · 29.2K reputationPosted Oct 30, 2011, 3:27 AM EDT
The code would be something like this:
yuriy thebest7 reputationPosted Oct 30, 2011, 7:13 AM EDT
VulpesRank #55 · 29.2K reputationPosted Oct 30, 2011, 7:41 AM EDT
Suthish NairRank #92 · 22.8K reputationPosted Nov 1, 2011, 8:16 AM EDT