Implementing the Ammunition Class
Although tanks firing huge missiles with a lot of explosions everywhere is probably what you're used to seeing in a game (or movie), you can make this implementation simpler. Your bullets can be small bouncing pellets because, after all, I'm sure you don't want to promote violence! What you need now is an implementation.
Continuing with the theme in Tankers, you create a new code file for the “bullet” class. The included CD calls the file bullet.cs, and the initial implementation appears in Listing 15.1.
Listing 15.1. The Bullet Class
using System; using System.Collections; using Microsoft.DirectX; using Microsoft.DirectX.Direct3D; using Microsoft.Samples.DirectX.UtilityToolkit; namespace Tankers { /// <summary> ... |
Get Beginning 3D Game Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.