Game Development Reference
In-Depth Information
In the case of games, that means going back to the drawing board, planning out what
you want the enemies to do, and then deducing from that plan what you need to pro-
gram. Contrary to real life, you have full control over the enemies. Doesn't that make
you feel powerful? But before you or anyone else can have fun, you need to come up
with a plan for world domination.
I already created the graphics for three different types of enemies. At this point, I know
only that at least one of them is supposed to be a boss monster. Take a look at Figure
8-1 and try to imagine what these enemies could be up to.
Figure 8-1 . The graphics used as the game's enemy characters
Before you start programming, you should have a good understanding of which behavi-
ors the enemies will have in common so that you program those parts only once. Elim-
inating code duplication is the single most important goal of clean code design.
Let's see what we know for sure is common to all enemies:
▪ Shoots bullets
▪ Has logic that determines when and where to shoot what bullet
▪ Can be hit by player's bullets
▪ Cannot be hit by other enemy's bullets
▪ Can take one or more hits (has health)
▪ Has a specific behavior and movement pattern
▪ Has a specific behavior or animation when destroyed
▪ Will appear outside the screen area and move inside
▪ Will not leave the screen area once inside
When you look at that list, you may notice that some of these attributes also apply to
the player's ship. It certainly can shoot bullets, we may want it to sustain multiple hits,
and it should have a specific behavior or animation when destroyed. It makes sense to
 
 
Search Nedrilad ::




Custom Search