Contents

Contents at a Glance

Foreword

About the Author

About the Technical Reviewers

About the Game Graphics Designer

Acknowledgments

Preface

Part I: Planning and Creating 2D Games

imagesChapter 1: Welcome to Android Gaming

Programming Android Games

Starting with a Good Story

Why Story Matters

Writing Your Story

The Road You’ll Travel

Gathering Your Android Development Tools

Installing OpenGL ES

Choosing an Android Version

Summary

imagesChapter 2: Star Fighter: A 2-D Shooter

Telling the Star Fighter Story

What Makes a Game?

Understanding the Game Engine

Understanding Game-Specific Code

Exploring the Star Fighter Engine

Creating the Star Fighter Project

Summary

imagesChapter 3: Press Start: Making a Menu

Building the Splash Screen

Creating an Activity

Creating Your Splash Screen Image

Working with the R.java File

Creating a Layout File

Creating Fade Effects

Threading Your Game

Creating the Main Menu

Adding the Button Images

Setting the Layouts

Wiring the Buttons

Adding onClickListeners

Adding Music

Creating a Music Service

Playing Your Music

Summary

imagesChapter 4: Drawing The Environment

Rendering the Background

Creating the Creating the Creating the

Creating a Renderer

Loading an Image Using OpenGL

Scrolling the Background

Adding a Second Layer

Loading a Second Texture

Scrolling Layer Two

Working with the Matrices

Finishing the scrollBackground2() Method

Running at 60 Frames per Second

Pausing the Game Loop

Clearing the OpenGL Buffers

Modify the Main Menu

Summary

imagesChapter 5: Creating Your Character

Animating Sprites

Loading Your Character

Creating Texture Mapping Arrays

Loading a Texture onto Your Character

Setting Up the Game Loop

Moving the Character

Drawing the Default State of the Character

Coding the PLAYER_RELEASE Action

Moving the Character to the Left

Loading the Correct Sprite

Loading the Second Frame of Animation

Moving the Character to the Right

Loading the Right-Banking Animation

Moving Your Character Using a Touch Event

Parsing MotionEvent

Trapping ACTION_UP and ACTION_DOWN

Adjusting the FPS Delay

Summary

imagesChapter 6: Adding the Enemies

Midgame Housekeeping

Creating a Texture Class

Creating the Enemy Class

Adding a New Sprite Sheet

Creating the SFEnemy Class

The Bezier Curve

Summary

imagesChapter 7: Adding Basic Enemy Artificial Intelligence

Getting the Enemies Ready for AI

Creating Each Enemy's Logic

Initializing the Enemies

Loading the Sprite Sheet

Reviewing the AI

Creating the moveEnemy() Method

Creating an enemies[] Array Loop

Moving Each Enemy Using Its AI Logic

Creating the Interceptor AI

Adjusting the Vertices

Locking on to the Player's Position

Implementing a Slope Formula

Creating the Scout AI

Setting a Random Point to Move the Scout

Moving Along a Bezier Curve

Creating the Warship AI

Summary

imagesChapter 8: Defend Yourself!

Creating a Weapon Sprite Sheet

Creating a Weapon Class

Giving Your Weapon a Trajectory

Creating a Weapon Array

Adding a Second Sprite Sheet

Initializing the Weapons

Moving the Weapon Shots

Detecting the Edge of the Screen

Calling the firePlayerWeapons() Method

Implementing Collision Detection

Applying Collision Damage

Creating the detectCollisions() Method

Detecting the Specific Collisions

Removing Void Shots

Expanding on What You Learned

Summary

Reviewing the Key 2-D Code

imagesChapter 9: Publishing Your Game

Preparing Your Manifest

Preparing to Sign, Align, and Release

Checking the Readiness of AndroidManifest

Creating the Keystore

Summary

Part II: Creating 3D Games

imagesChapter 10: Blob Hunter: Creating 3-D Games

Comparing 2-D and 3-D Games

Creating Your 3-D Project

BlobhunterActivity.java

BHGameView

BHGameRenderer

BHEngine

Creating a 3-D Object Test

Creating a Constant

Creating the BHWalls Class

Instantiating the BHWalls Class

Mapping the Image

Using gluPerspective()

Creating the drawBackground() Method

Adding the Finishing Touches

Summary

imagesChapter 11: Creating an Immersive Environment

Using the BHWalls class

Creating a Corridor from Multiple BHWalls Instances

Using the BHCorridor Class

Building the BHCorridorClass

Adding a Wall Texture

Calling BHCorridor

Summary

imagesChapter 12: Navigating the 3-D Environment

Creating the Control Interface

Editing BHEngine

Editing BlobhunterActivity

Moving Through the Corridor

Adjusting the View of the Player

Summary

Reviewing the Key 3-D Code

Index

..................Content has been hidden....................

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