Game Development Reference
In-Depth Information
The health bar and bullet actors will be rendered programmatically with Core Graphics instead of using
a pre-rendered image. The other actors—saucers and shields—exist in this example to provide a
little context (got to have something to shoot with the bullets) and flesh out our example from the last
chapter in terms of behaviors. Figure 7-1 shows the saucers, bullets, shields, and health bars in action.
Figure 7-1. Saucers, bullets, shields, and health bars
In Figure 7-1 , we see a flying saucer in the middle of the screen. Coming from the right and traveling
left are a number of circular bullets. The bullets come in three different sizes, which reflect their
potential for damage. If a bullet collides with the saucer, a shield effect is added to the flying saucer
and the health bar goes down, indicating the damage done. In this example, the bullets will keep
coming until the saucer's health is zero, at which point it is removed and a new flying saucer is
added. Figure 7-2 shows the three difference saucers used in this example, as well as the graphic
used for the shield.
 
Search WWH ::




Custom Search