Figure 12-9 shows you the invader model and its texture.
The invader model follows the same principles as the ship model. We have one OBJ file storing the vertex positions, texture coordinates, normals and faces, and a texture image.
The shield blocks and shots are modeled as cubes and are stored in the files shield.obj and shot.obj. Although they have texture coordinates assigned, we don't actually use texture mapping when rendering them. We just draw them as (translucent) objects with a specific color (blue in the case of the shield blocks, yellow for the shots).
Finally there are the explosions (see Figure 12-3 again). How do we model those? We don't. We'll do what we did in 2D and simply draw a rectangle with a proper z-position in our 3D world, texture mapping it with one frame from a texture image containing an explosion animation. It's the same principle we used for the animated objects in Super Jumper. The only difference is that we will draw the rectangle at a z-position smaller than zero (wherever the exploding object is located). We can even abuse the SpriteBatcher class to do this! Hurray for OpenGL ES. Figure 12-10 shows you the texture.
Figure 12-10. The explosion animation texture (explode.png, 256x256 pixels)
Each frame of the animation is 64x64 pixels in size. All we need to do is generate TextureRegions for each frame and put them into an Animation instance we can use to fetch the correct frame for a given animation time, just as we did for the squirrels or Bob in Super Jumper.
Was this article helpful?