So that’s the game well past the 99% mark. Now, all that needs to be done is some polishing graphical touches, notably the Main Menu and Credits, which I’m assured will be done by tomorrow. Overall, I feel the game’s a success. Not only is it pretty and very nice portfolio piece, it’s actually pretty fun to play! I worked very hard on the player controls to get them smooth, and spent days working out formulas for acceleration and deceleration. But finally, it’s almost over. Once it’s 100% done, I’ll do a more reflective post, detailing what I’ve learned about Programming, Game Design and general Project Management. For now, I’ll list most of the features of the game and talk a little in depth about them.
First of all, the game features a Main Menu. While very basic looking now, this will have some treatment in a few days to pretty it up! There are four button’s on the main menu, all fairly self explanatory. When the mouse is hovered over one of the buttons, the buttons light up (Play is lit up in the screenshot). This was done with a simple animation sheet, containing two nearly identical images. The first one was the button darkened, the second was lightened. Then the game switches between them when the mouse coordinates collide with the button, it’s as simple as that!
Loading was done very simply. Basically, during gameplay, if the user pressed S then the player’s current level, score, and position, are saved to a .txt file. When load is clicked, this data is loaded in and the user started from where they left off. Very simply done, yet I’ve not had a problem with it. And, because it’s so simple, there’s very little that can go wrong with it!
Next, I’ll talk about the scoreboard. The scoreboard reads in it’s data from a .txt file of saved data, which looks like this.
Then the data is read in from the program, and rearranged by score size (just to avoid any glitches). If the player’s score is greater than the smallest score, then they’re prompted to enter their name into a separate window. Once they hit enter, their name will appear on the scoreboard, which will change the data in the .txt file to the new scores.
The main game is made up of three parts, from a programming perspective. I divided them up for my own sake, so I’d know changing one part wouldn’t mess up everything else. It’s the Initialization class, GameLogic class, and Rendering class.
The initialization simply loads everything in the game, mostly from .txt files. Everything that’s loaded is outputted to the console, which is good so I can see which parts take longest to load, as well as, when the game crashes, what the last message outputted was. Since every game objects data is stored in a .txt file, I only load them in once, at the start. Then I load in level data, which is simple object positions. Then, when changing levels, I reset every Entity’s position then load in new ones from a different .txt file. Since I only load in positions, and not data, changing level is very fast compared to the initial loading.
The GameLogic class actually does very little itself, instead delegating work out to even more classes. The Player’s Animation and Controls are separate classes, as well as most Collisions. The only thing it really handles is the shooting for the player and enemies, and that’s only because I was rushing them a bit to get them done and didn’t create class for them (though I really should have). They do, however, have structs holding data so creating a class shouldn’t take too long, if I ever get around to doing it…
Now, the Rendering. That’s one of the thing’s I’m most proud of, and something I haven’t touched since the start of the summer. Basically, every object is passed into the Renderer upon creation. In there, the Renderer sorts them by their Depth value, drawing objects with a lower depth first. That’s it really, and it’s worked so well I haven’t had to touch it for most of the summer!
Now, the secret, forth part, the level editor. While technically a part of the Main Game, it’s never touched by the User. Yet I’m very proud of it and thought it deserved a mention. Basically, upon pressing CTRL, the User will reset every Entity’s position and a menu will be brought up for placing objects. They can scroll left and right through the level, place and delete objects, and save all their changes to the Level’s .txt file.
I’ll do another blog post within the next day or two, detailing what I’ve learned from making this game, as well as a link to a Dropbox downloadable version of the game itself.