Creating the Assets

As in the previous games, you have two kinds of graphical assets: UI elements, such as logos or buttons, and the models for the different types of objects in the game.

The UI Assets

Create your UI assets relative to some target resolution. Your game will be run in landscape mode, so simply choose a target resolution of 480×320 pixels. The screens in Figure 12–4 already show the elements in your UI: a logo, different menu items, a couple of buttons, and some text. For the text, reuse the font from Super Jumper. You've already done the compositing for these in previous games, and You've learned that putting them into a texture atlas can be beneficial for performance. The texture atlas for Droid Invaders, containing all the UI elements (as well as the font for all the screens in the game), is shown in Figure 12–6.

images

Figure 12–6. The UI element atlas, with buttons, logo, and font. It is stored in the file items.png, 512×512 pixels

This is essentially the same concept used in Super Jumper. You also have a background that will be rendered in all screens. Figure 12–7 shows this image.

images

Figure 12–7. The background stored in background.jpg. 512×512 pixels

As you can see in Figure 12–4, you only need to use the top-left region of this image to render a full frame (480×320 pixels).

That's all the UI elements needed. Now you can look at your 3D models and their textures.

The Game Assets

As mentioned in Chapter 11, this book can't possibly go into detail on how to create 3D models with software like Wings3D. If you want to create your own models, choose an application to work with and plow through some tutorials, which are often freely available on the net. For the models of Droid Invaders, you can use Wings3D and simply export them to the OBJ format, which you can load with your framework. All models are composed of triangles only, and they have texture coordinates and normals. You won't need texture coordinates for some of them, but it doesn't hurt to have them.

The ship model and its texture are illustrated in Figure 12–8.

images

Figure 12–8. The ship model in Wings3D (ship.obj) and its texture (ship.png, 256×256 pixels)

The crucial thing is that the ship in Figure 12–8 has roughly the “radius” outlined in the previous section. You don't need to scale anything or transform sizes and positions from one coordinate system to the other. The ship's model is defined with the same units as its bounding sphere!

Figure 12–9 shows the invader model and its texture.

images

Figure 12–9. The invader model (invader.obj) and its texture (invader.png, 256×256 pixels)

The invader model follows the same principles as the ship model. Have one OBJ file store 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, don't actually use texture mapping when rendering them. 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 you model those? You don't. Do what you did in 2D and simply draw a rectangle with a proper z-position in the 3D world, texture mapping it with a frame from a texture image containing an explosion animation. It's the same principle you used for the animated objects in Super Jumper. The only difference is that you draw the rectangle at a z-position smaller than zero (wherever the exploding object is located). You can even abuse the SpriteBatcher class to do this! Hurray for OpenGL ES. Figure 12–10 shows you the texture.

images

Figure 12–10. The explosion animation texture (explode.png, 256×256 pixels)

Each frame of the animation is 64×64 pixels in size. All you need to do is generate TextureRegions for each frame and put them into an Animation instance you can use to fetch the correct frame for a given animation time, just as you did for the squirrels or Bob in Super Jumper.

Sound and Music

For the sound effects, use sfxr again. Find the explosion sound effect on the Web. It's a public domain sound effect, so you can use it in Droid Invaders. For our own version of Droid Invaders, we recorded the music ourselves with real instruments. Yes—that's very old-school. Here's the list of audio files for Droid Invaders.

  • click.ogg, a click sound used for the menu items/buttons
  • shot.ogg, a shot sound
  • explosion.ogg, an explosion
  • music.mp3 the rock/metal song written for Droid Invaders
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset