You are previewing Building your First Mobile Game using XNA 4.0.
O'Reilly logo
Building your First Mobile Game using XNA 4.0

Book Description

A fast pace hands on guide towards building a 3D game for the Windows Phone 7 platform using XNA 4.0.

  • Building a 3D game for the Windows Phone 7 platform

  • Drawing 2D and 3D graphics on Windows Phone.

  • Using the rich capabilities of the Windows Phone platform.

  • Creating a custom framework step by step that will act as a base for building (future) games.

  • An engaging and hands on beginner’s guide to Windows Phone 7 3D game development using XNA 4.0.

In Detail

With the dawn of the Windows Phone 7 platform, Microsoft has offered us an easy way to create 3D mobile games. In this book, we will build a 3D game for Windows Phone 7 together, taking full advantage of the graphics and touch capabilities, along with the sensors of the platform.

"Building your first mobile game using XNA" is the book for starting game development on the Windows Phone 7 platform. This book will go over the technical aspects of building games along with designing your own framework. Finally we’ll build an actual game together from the ground up! This book will set future mobile game developers in the right direction.

The XNA framework empowers us to build 2D and 3D games for PC, Xbox 360 and Windows Phone 7. We will use those capabilities to create stunning 3D games for the Windows Phone 7 platform. We will start by covering the basics like drawing graphics, followed by building a custom framework and end with building a game together!

In this book, we will cover drawing 2D and 3D graphics, both static and animations. We will also cover the various ways of handling user input and help set the mood of our game playing both 2D and 3D sound, and accessing the user’s media library. The only thing left before building a game is covering several techniques created for making our life easier while building the game, whilst building a framework to do just that. Finally, we’ll build a 3D game together that will run on the Windows Phone 7 platform.

"Building your first mobile game using XNA" is the book you need to get started with mobile game development for Windows Phone 7. Its hands on approach will set you on your way in no time. Let’s build some games!

Table of Contents

  1. Building your First Mobile Game using XNA 4.0
    1. Table of Contents
    2. Building your First Mobile Game using XNA 4.0
    3. Credits
    4. About the Authors
    5. Acknowledgement
    6. About the Reviewers
    7. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
        3. Instant Updates on New Packt Books
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
      7. Downloading the color images of this book
        1. Errata
        2. Piracy
        3. Questions
    9. 1. Getting Started
      1. Developing for Windows Phone
        1. Installing the Windows Phone SDK
        2. Registering your Windows Phone
      2. Getting started with your first application
      3. The Game class
        1. Fields
        2. Constructor
        3. Initialize
        4. LoadContent
        5. UnloadContent
        6. Update
        7. Draw
      4. Summary
    10. 2. 2D Graphics
      1. 2D coordinate system
      2. Adding content
      3. Drawing sprites
        1. Adding fields
        2. Loading textures
        3. Drawing textures
      4. Refactoring our code
        1. Render context
        2. The base class
          1. Properties
          2. Constructor
          3. Methods
        3. Building the GameSprite class
          1. Fields
          2. Properties
          3. Constructor
          4. Methods
        4. Updating MainGame
          1. Fields
          2. Initialize
          3. LoadContent
          4. Update
          5. Draw
        5. Result
      5. Adding movement to the hero
        1. The Hero2D class
          1. Fields
          2. Initialize
          3. LoadContent
          4. Update
          5. Draw
        2. Updating the game class
        3. Result
      6. Adding animation to our hero
        1. Sprite sheets
        2. The GameAnimatedSprite class
          1. Fields
          2. Properties
          3. Constructors
          4. Play, pause, and stop
          5. Update
        3. Updating Hero2D
          1. Fields
          2. Initialize
          3. Update
        4. Result
      7. Summary
    11. 3. 3D Graphics
      1. 3D coordinate system
      2. Using matrices
      3. Drawing models
        1. Adding fields
        2. Initialize
        3. Loading models
        4. Drawing models
        5. Result
      4. Mixing 2D and 3D
      5. Refactoring our code
        1. The base class
          1. Properties
          2. Constructor
          3. Methods
        2. The camera
        3. Updating RenderContext
        4. The GameModel
          1. Fields
          2. Constructor
          3. Methods
        5. Updating MainGame
          1. Fields
          2. Initialize
          3. LoadContent, Update, and Draw
        6. Result
      6. Adding movement to the hero
        1. The Hero3D class
          1. Fields
          2. Initialize
          3. LoadContent and Draw
          4. Update
        2. Updating the Game class
        3. Result
      7. Adding animation to our hero
        1. The GameAnimatedModel class
          1. Fields
          2. LoadContent
          3. Update
          4. Controlling animations
          5. Draw
        2. Updating Hero3D
        3. Result
      8. Exercise: adding enemies
      9. Summary
    12. 4. Input
      1. Using keyboard
      2. Using the accelerometer
      3. Using touch
      4. Gestures
        1. Enabling gestures
        2. Reading gestures
      5. Summary
    13. 5. Sound
      1. Before we start
      2. Playing sound
        1. SoundEffect
        2. Setting volume, pitch, and pan
        3. SoundEffectInstance
          1. Fields
          2. LoadContent
      3. Playing 3D sound
        1. Fields
        2. LoadContent
        3. Update
        4. Result
      4. Playing a song
      5. Summary
    14. 6. Building a Basic Framework
      1. Scene graph
        1. Implementation
          1. Fields
          2. Constructor
          3. Methods
        2. Using the code
      2. Scene manager
        1. The GameScene
          1. Properties
          2. Constructor
          3. Methods
        2. The SceneManager
          1. Properties
          2. Constructor
          3. Managing the scenes
          4. Initialize and LoadContent
          5. Update and Draw
        3. Creating scenes
        4. Updating the main game
          1. Initialize
          2. LoadContent
          3. Update and Draw
        5. Result
      3. Collision
        1. The extension method
        2. Updating GameObject2D
        3. Updating Hero2D
        4. Testing for collisions
        5. Result
      4. Menus
        1. The button
          1. Fields and events
          2. Constructor
          3. LoadContent
          4. Update
        2. The menu scene
        3. Result
      5. Summary
    15. 7. Building a Game
      1. Game concept
      2. Menu scene
        1. Fields
          1. Constructor
          2. Initialize
          3. LoadContent
      3. Level Scene
        1. Prerequisites
        2. Level Scene
        3. Background
          1. Fields
          2. Initialize
          3. Update
          4. Scene Implementation
        4. Path
          1. Fields
          2. Initialize
          3. Update
          4. Scene Implementation
          5. Scene Camera
        5. Buttons Controller
          1. Fields and properties
          2. Initialize
          3. RandomizeButtons method
          4. Update
          5. ForceButtonRelease method
          6. Scene Implementation
        6. Hero
          1. Fields and properties
          2. Initialize
          3. SetHeroAction method
          4. Update
          5. Scene Implementation
        7. Swing Ball
          1. Prerequisites
          2. Fields
          3. Initialize
          4. LoadContent
          5. Update
          6. Scene Implementation
        8. Spikes
          1. Fields
          2. Initialize
          3. Scene Implementation
        9. Enemy
          1. Fields and properties
          2. Constructor
          3. Initialize
          4. EnemyAnimationComplete method
          5. LoadContent
          6. Update
          7. Draw
          8. Scene implementation
        10. Perspective Camera
          1. Constructor
          2. Bringing it all together
          3. Extra Fields
          4. AddObstacle method
          5. ResetLevel method
          6. Deactivate
          7. SetObstacle method
          8. Initialize extension
          9. Update extension
      4. Summary
    16. 8. Releasing our game
      1. Testing
      2. Creating a trial version
      3. Application certification requirements
      4. Application submission process
      5. Summary
    17. Index