Houston we have reached foul circle

So lets try to listen to my comments and learn from them! I will now try to write about artifacts rather than talk about every decision and achievement in programming I’ve done.

This week have been actually pretty effective. I’ve been working these past weeks a lot with states to understand and following my classmates advice
-if you want to do it, do it everywhere

So during the week I’ve been working on getting a pause state going so you can orientate to your customize page, quit your game to main menu or simply resume the game after a break.

The class itself is a state with three buttons but the interesting part was how I pause the game and keep that way until you try to go through the main menu for a new game.

The button themselves are created by another class where you specify them with a sprite, a string name, a position, an input object and a shape. More on this can be found in –Link-. I simply had to change the name on the “nextstate” method and return a false value to quit the update loop for it to move on to the next state but here is the interesting part. To actually pause the game you have to keep the same GameObjectManager object throughout the whole pause menu unless you go to the main menu.

I created an short integer(a value holder with less memory than a regular one) I called  m_paused in the core/engine class. I put it into the GameState class to make sure it wont clean up it’s object and create a new one unless you initialize it from the MainMenu State where as the m_pause becomes 1 and 1 means you create a new GameObjectManager object and delete the old one.

This allowed us to navigate through the GameState to PausMenu and from there go to either Customize, MainMenu or simply resume where you where at that moment. So in short the only reason why it works is because I have a value holder that works with if statements whether or not it’s ok to delete the GameObjectManager object you are currently in or not. I from there was able to create a back button than went directly to the game from the customize state so you get to the action quicker.

The reason we went with this is because as a lead designer I wanted you to cool off, the game is such a stressed one you never seem to have a break from anything so getting enough score to update your weapons, truck and suit will calm your nerves before venturing into hell again. I find it important because everybody can’t hold waves of enemies without a small break so without actually having one I want the player to create their own breaks during the game.

The next thing was to make sure you could upgrade your equipment by using your score. I couldn’t reach my private values in score so instead of putting everything in the public place or creating a friend class I did the less effective way. Something I will probably change later on. I created in the class a score object is used(GameObjectManager) two new methods, GetScore() and  Buy(). Whenever I pressed the upgrade button on either suit, weapon or truck I had a command running to the score buy method in GOM to the score class and changed it’s value depending on how much it costs and increased the initial price for the next suit/weapon/truck with more score points  so you couldn’t just buy it unless you had enough score. Remember that you buy stuff in a state called customize, there is a price for every upgrade and you couldn’t buy it unless you either had exactly that score or more.

So the new readers understand how this works I will explain this a bit easier.
*I play the game*reach 1000 score points
*Paus the game
*Press customize
*Press on the upgrade button for suit
*the program check if I have 1000 score points by looking at the GOM object that’s pointing at it’s Score class Object that’s in there
*I have it! it’s bought and I’ve go through the Buy() method in the GOM class that in itself goes to a method named BuyEquipment() in the score class that takes a integer(value holder) that the customize class has which uses this simple calculation m_score -= Equipment_Value; which deletes that amount of score that specific suit costs
*After all of this I add 1200 more score points on the new equipment that shows up so you have to get 2200 before you can buy the next one.

It took me 6 new methods and 3 new integers to make it possible when in retrospect I could have just done a friend class in the customize page and went directly to the score class through the customize state and used Buy() and GetScore() instead. I still would have used the 3 integers(Value_Suit and so on) but I would have shaved off 3 methods and went directly to the score page. This will be probably something I will implement further down the road.

At this point your eyes are probably bleeding by the wall of text that’s going through your mind with repeats and TD:DR’s but hey it’s thorough!

Now to why the title is worded that way.

Just to show that I’ve become proficient in states I even created a DieState. Our sketch for this state was to have a text that gives you the score you finally got before you died/won and three buttons, MainMenu(where you have a quit button), Highscore(to brag) and Retry(delete the GOM object and create a new one).
This one was simple to make because it’s very similar to the PauseState I created earlier so I only copied the PauseState code, changed the necessary names and took away the customize button for a highscore button(not implemented, non working). I from there created a new method in the GOM class called Dead() to know when you when you died and only returns a method in score that writes a canadian letter like so:

“you have died, sorry but here you is your silver(score): -SCORE VALUE-”

Screenshot 2014-02-27 10.41.51

The MainMenu button is similar to the Pausemenu and the only thing I changed in the Retry is to change the Core->m_paused(short integer we talked about earlier) to 1(which restarts the game) instead of 2(which resumes the game)

That’s about it! I’ve been working on an animation state and AnimatedSprite class at the moment which I will be talking about next week so we’ll see how that goes.

Much love,

Ladbon