Game Development Reference
In-Depth Information
Sound is also very simple to add. A sound manager needs to be created as it
was earlier in the topic, and a number of suitable sounds could be generated
for shooting, exploding, and taking damage. Then you just need to find the
places where explode, damage, and shoot events occur and make a call to the
sound manager to play the correct sound. The main bulk of the work is
passing the sound manager through all the objects so that it can be used
where it's needed.
Regarding the code, there is a large number of managers and a few scattered
functions with similar code. The code could be made tighter and easier
to extend if these managers were generalized and any repeated code was
removed. A good starting point is to see what similar methods each of the
managers use and then consider extending the Entity class so one general
EntityManager could be created.
The game's single level is defined in the EnemyManager constructor. This
isn't very extendable. A good starting project might be to define the level
definitions in a text file. On load-up the program can read the text and load
the level definition. The level definition could be very simple, such as
cannon_fodder, 30
cannon_fodder, 29.5
cannon_fodder, 29
cannon_fodder, 28.5
Each line has an enemy type and a launch time separated by a comma. This
is very easy to parse and read into a Level definition class. The level data
should probably be stored in a PersistantGameData class.
Once you have one level loaded, it's easy to make a new level file, and then
suddenly you have the potential for a multi-level game. When one level is
successfully finished, instead of returning the StartGameState , the state
could return to the InnerGameState but using the next level. If the game
has multiple levels, then it would good if the game was able to save the
player's progress through these levels. A very simple way to save the game
data would be to write out the score and current level to a text file.
Instead of having a linear level progression (1,2,3,4), the user could be
presented with an overworld map to select which levels he'd like to complete
 
Search WWH ::




Custom Search