Adding Obstacles

Congratulations. This is the first interactive 3D graphics application you've created. The effect of simulating car movement has been achieved. While you know that it's really the road that is moving below the car, it appears as if the car is speeding down the road. You've got half of the gameplay options implemented already. What you need now are the obstacles that you will be trying to avoid. Much like you added the car class, add a new class called “Obstacle”. Make sure you add the using clauses for the Managed DirectX references for this code file as well.

Rather than using the same mesh for every obstacle, it would be nice to have a little variety in the obstacle list: in both type of obstacle as well as color. You can use ...

Get Managed DirectX® 9 Kick Start: Graphics and Game Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.