Chapter 15. Wrapping Up Your 3D Game

Here we go—you’re at the final stage in the development of your first 3D game. It looks good, sounds good, and plays well, and all that’s left to do is to add some game logic and wrap it up. First things first: you need a splash screen when your game starts. In addition, you’ll need to provide the player with some kind of an indicator when she reaches another level in the game. Why not use a splash screen between levels, too? Finally, you’ll need to have a screen that displays the final score when the game is over. Sounds like a good solution to these problems would be to create a splash screen game component that will let you display text on the screen. That way, you can reuse the same class for all three purposes just mentioned—and let’s face it, anytime you can reuse code, you’re saving yourself all kinds of time and headaches.

This chapter picks up where Chapter 14 left off. Open the project that you were working on at the end of Chapter 14 and use it throughout this chapter.

Adding a Splash Screen Game Component

Before we jump in and code your splash screen component, let’s step back and look at how this is going to work. Your Game1 class is going to manage different game states. Several states are possible: starting the game, playing the game, pausing the game between levels, and showing a game-over screen at the end of the game.

To help you manage these states, create an enum in your Game1 class that you will use to track changes from state ...

Get Learning XNA 4.0 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.