O'Reilly logo

Beginning Android 4 Games Development by Robert Green, Mario Zechner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The WorldRender Class

Recall what you have to render in 3D:

  • The ship, using the ship model and texture, and applying lighting.
  • The invaders, using the invader model and texture, again with lighting.
  • Any shots on the playfield, based on the shot model, this time without texturing but with lighting.
  • The shield blocks, based on the shield block model, again without texturing, but with lighting and transparency (see Figure 12–3).
  • Explosions instead of the ship or invader model, in case the ship or invader is exploding. The explosion is not lit, of course.

You know how to code the first four items on this list. But what about the explosions?

It turns out that you can abuse the SpriteBatcher for this. Based on the state time of the exploding ship ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required