Chapter 13. Shooters and bullets

We want for critters to be able to spawn off additional objects. The most common use of this is for shooting games in which the critters shoot at the player and the player shoots back. Do keep in mind that a game with this pattern can in fact be given a non-violent framing story. The critters might be dropping jewels that you want to pick up. Or you might be throwing food at them. Perhaps you're on a safari taking pictures, and you're firing flashbulbs. This said, let's go ahead and speak in terms of shooting bullets.

In order to prevent the player from drowning the screen in bullets and having the game be too easy, we will allow only some limited number of player bullets to be active at one time. Suppose you want to allow the player to have at most eight bullets active at one time. When there are already eight bullets present and the user presses the shoot control, what happens then?

There are two alternatives. One approach is to have the shoot control go dead until one of the eight active bullets hits something or dies of old age. This is not satisfying as then, if the player is menaced by some approaching enemy and all the bullets are in use, the player is left defenseless. A better approach is to have the shooting of a ninth bullet remove the oldest bullet from the screen. This specification-level decision will affect our design.



    Part I: Software Engineering and Computer Games
    Part II: Software Engineering and Computer Games Reference