Chapter 23. Shooting a GunIt's an unfortunate fact that shooting (and being shot) is a major part of many types of games. Exact percentages are hard to come by, but I've seen figures which indicate that perhaps 40 percent of the top-selling console games involve shooting, rising to 50 percent for PC games. My own feeling is that the percentages are much higher. I'm writing this as Christmas 2004 approaches, and the top action games for the PC include Half-Life 2, Doom 3, Medal of Honor: Pacific Assault, The Lord of the Rings: Battle For Middle Earth, Warhammer 40,000: Dawn of War, World of Warcraft, and so on. Where's the peace and harmony gone? Santa better have some serious armor on his sleigh this Yuletide. Action games can be categorized into third person and first person. Third-person games frequently utilize a viewpoint slightly above and behind the main character as in Splinter Cell and Hitman. First-person games put the gun in your hand, with a viewpoint linked to the gun, as in Doom and Half-Life. This chapter looks at how to get an object in the scene to shoot. This is a prerequisite for third person games and, of course, is needed in first person games when the enemy fires back. Chapter 24 is about first person shooting, where the shot comes from your own gun. The Shooter3D application contains a gun (a cone mounted on a cylinder) which fires a laser beam at a point on the checkered floor clicked on by the user. The flight of the laser beam (a red cylinder) is accompanied by a suitable sound and followed by an explosion (an animated series of images and another sound). Figure 23-1 shows three screenshots of Shooter3D. The first one has the laser beam in mid-flight, the second captures the explosion, and the third is another explosion after the user has clicked on a different part of the floor, from a different viewpoint. Figure 23-1. The deadly Shooter3DThe cone head rotates to aim at the target point, and the animated explosion always faces the user. Here are some Java 3D and Java features illustrated by this example:
|
Monday, January 4, 2010
Chapter 23. Shooting a Gun
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment