Monday 25 August 2014

Ludum Dare #30 Dev Journal: Salvation – Adding numbers and Spaceships!

Ok, so after a mini heart attack because I accidently must have deleted one of my scripts, I managed to get it back. Thanks to the people in IRC using logic for me and telling me to check my recycling bin. Silly mistake. I now make backups more often than anything else!

Anyhow, so far so good. I planned out how to tackle the next part of my game. The stats tracking. I jotted down a very simple class diagram to get a feel for my overall games construction.




As I note in the little diagram, it makes a lot of sense to use my Building_Instance class to also set all my building stats. This class sets the current selected buildings vector, and calls the kill method in the OverLord class. Pretty much all things I do with a specific building is dealt with here so why not add all the stats? So I did!


void setRedHAB_stats(){
int populationIncrease = 50;
int buildingCost = 50;
tempBuildingManager.setPop(populationIncrease);
tempBuildingManager.deductCash(buildingCost);
}

void setSolarArray_stats(){
int moneyIncrease = 100;
int buildingCost = 50;
tempBuildingManager.setCash(moneyIncrease);
tempBuildingManager.deductCash(buildingCost);
}


Once they are added here I have a fresh new class where I manage all the buildings effects on the game world. Things like the overall population/current funds etc. I use the Instance class to add each specific buildings stats upon their instantiation. The Manager class then applies these stats to the overall global stats. I added in some debug GUIText to keep track of the global stat numbers.

Next up I am adding spaceship! I keep telling myself not to as they will take a lot of time to get working the way I want them to but then again THEY ARE SPACE SHIPS! D: The plan is to have each spaceship, depending on what world they come from, to add 5 population to the current overall population. The population is going to be broken down into 4 sections, 1 for each worlds race.

So every x amount of minutes, a spaceship or a few depending on things, will dock at the facility. If you can accommodate the refugees (have enough HABs built), then they will be added to your global population. If not, they will not be added, and I plan on adding some more ships that leave the facility. These poor, sick, unwanted refugees will be on those ships.




Back to coding now!
Hobo out!



No comments:

Post a Comment