[ This chapter does not appear in the book. ]
It's time to track down those penguins from earlier chapters and treat them with extreme prejudice.
GunnerM3G is a simple FPS (First-Person Shooter), where you roam about looking for two penguins to shoot at. Once a penguin's been blasted three times, it disappears from the scene. Each time you fire the gun, there's a flash of light and a pleasing laser beam-like noise. If the gun's pointing at a penguin, they're enveloped in a nasty looking animated fireball, accompanied by an explosion sound.
The pictures on the right show the user amongst the penguins, moving in on one of them and testing the gun, and finally blasting away.
The new programming elements in GunnerM3G:
A guiding principle is to fake the 3D effects as much as possible. The "gun hand", the "shot flash", the explosions, the floor, and the background are all 2D visuals wrapped over simple rectangular meshes. Only the penguins are complicated models: they must have 3D depth, since the user can move around them.
Readers may recognize some elements from earlier chapters. The camera controls are based on those from the MobileCamera class, but we've (mercifully) dispensed with modes. The camera only moves forwards, backwards, and turn left or right. The floor is a tiled texture, created using TiledFloor from M3G chapter 4.
A final touch is that the penguins are randomly positioned on the floor each time the MIDlet begins, and the floor and background images are randomly chosen from a small selection of alternatives. The image on the right shows another execution of GunnerM3G.
There are numerous ways GunnerM3G could be improved. One of them is to add actual laser beams (or bullets, or whatever). Although the visuals include a "shot flash" and an explosion, there's no representation of the shot itself.
Dr. Andrew Davison
Back to my home page