Someone Has to Control the Tanks
Now that you have an actual world as well as a tank to reside in that world, you need some way to allow your players to interact with the tank (and as a side effect, the world). The player object you're about to take will be the first object you create that implements the IMoveableObject interface you defined in the last chapter. You will be able to detect whether any object that implements the interface is within the view frustum and should be rendered at all. Before you get there, though, you probably want to implement the class itself. Add a new code file player.cs, and see Listing 14.3 for an initial implementation.
Listing 14.3. The Player Class
using System; using System.Windows.Forms; using Microsoft.DirectX; ... |
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.