O'Reilly logo

Beginning 3D Game Programming by Tom Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Finishing Up the Player

You need to finish up just a few things in the player class before you're ready to begin using it. One of those things is to add the code that fires the bullets! You couldn't do it up to this point because the classes weren't defined, but now that you've implemented the bullet classes, this is the perfect time. What you want to do first is add a method to fire the round (Listing 15.8) to the player class.

Listing 15.8. Firing a Round
 /// <summary> /// Will add a new bullet to the list /// </summary> public void FireRound(Device device, Bullets list) { // Get the bullet start and velocity Vector3 bulletStart; Vector3 bulletVel; GetBulletStartLocation(out bulletStart, out bulletVel); // Finally add the new bullet list.Add(new ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required