The Simulation Classes

As usual, create a single class for each object in the world. You have the following:

  • A ship
  • Invaders
  • Shots
  • Shield Blocks

The orchestration is performed by an all-knowing World class. As you saw in the last chapter, there's really not such a huge difference between 2D and 3D when it comes to object representation. Instead of GameObject and DynamicObject, you can now use GameObject3D and DynamicObject3D. The only differences are that you use Vector3 instances instead of Vector2 instances to store positions, velocities, and accelerations, and you use bounding spheres instead of bounding rectangles to represent the shapes of the objects. All that's left to do is implement the behavior of the different objects in the world. ...

Get Beginning Android 4 Games Development 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.