Adding a Movable Car into Your Scene

Now that you have the road rendering, as well as moving through the scene, you should add the object the player will interact with: the car. You could simply put the car variables and constants and code into the main class where we have the road sections, but that just wouldn't be very modular. You will want to maintain the car code separately and in its own class. Create the car class now. From the project menu, select the Add New Item option, and choose to add a new class, named “Car”. Make sure you include the using clauses for the Managed DirectX references in this new code file that has been created for you.

What will the car class need to do? Since the car will remain stationary while everything moves ...

Get Managed DirectX® 9 Kick Start: Graphics and 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.