售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Mastering Android Game Development
Table of Contents
Mastering Android Game Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Setting Up the Project
The right tool for the right game
Do you want to use 3D?
Do you want to use physics?
Do you want to use Java?
Pros of building games with the Android SDK
Cons of building games with the Android SDK
I want the Android SDK!
The project – YASS (Yet Another Space Shooter)
Activities and Fragments
Project setup
Creating the stub project
Cleaning up
Choosing an orientation
Dealing with aspect ratios
Game architecture
GameEngine and GameObjects
Starting a game
Stopping a game
Managing game objects
UpdateThread
DrawThread
User input
Putting everything together
Moving forward with the example
Handling the back key
Honoring the lifecycle
Using as much screen as we can
Before Android 4.4 – almost fullscreen
Android 4.4 and beyond – immersive mode
Putting fullscreen together
Good practices for game developers
Object pools
Avoiding enhanced loop syntax in lists
Precreating objects
Accessing variables directly
Being careful with floating points
Performance myths – avoid interfaces
Summary
2. Managing User Input
The InputController base class
The Player object
Displaying a spaceship
Firing bullets
The Bullet game object
The most basic virtual keypad
Limitations and problems
Creating a virtual joystick
General considerations and improvements
Physical controllers
Handling MotionEvents
Handling KeyEvents
Detecting gamepads
Sensors and InputControllers
Selecting control modes
Summary
3. Into the Draw Thread
Using GameView
The GameView interface
StandardGameView
SurfaceGameView
Updating GameEngine
Updating the game layout
Improving DrawThread
Sprites
Updating the spaceship and bullets
Adding a frames-per-second (fps) counter
Spawning enemies – the GameController
Procedural/random
Deterministic/static
Hybrid approach
Our approach
The asteroids
More on the transformation matrix
Occlusion culling
Parallax backgrounds
Multiple backgrounds
Layers
Summary
4. Collision Detection
Detecting collisions
Who can collide?
Updating GameEngine
Handling collisions
Rectangular bodies
Adding visual feedback
Pros and cons
Circular bodies
Adding visual feedback
Pros and cons
Mixed collision detection
Adding visual feedback
Other options for shapes
Optimization
Spatial partitioning and QuadTree
Duplicated collisions
Summary
5. Particle Systems
General concepts
Particles
ParticleSystem
Initializers
Modifiers
Composite GameObjects and GameEngine
Making good particle systems
One shot
Asteroid explosions
Spaceship explosions
Emitters
Asteroid trails
The spaceship's engine
Summary
6. Sound FX and Music
SoundManager
Sound FX
How to create sound FXs
GameEvents
Using SoundPool
Playing music
Obtaining music
MediaPlayer
Music and Activity life cycle
Enabling and disabling music and sound FX
Updating MainMenuFragment
Updating SoundManager
Disabling system sounds
Summary
7. Menus and Dialogs
Custom fonts
Working with backgrounds
The power of XML drawables
State list drawables
State lists colors
Shape drawables
The GameFragment
Adding a score
Adding lives
Custom dialogs
BaseCustomDialog
Quit dialog
Pause dialog
Game Over dialog
Other dialogs
Designing for multiple screen sizes
Summary
8. The Animation Framework
Updating BaseFragment
AnimationDrawable
Animated sprites
Animating views
XML versus code
Interpolators
View animation
Animating dialogs
Delaying the action in the dialogs to onDismissed
Pulsating buttons
Property animation
ViewPropertyAnimator
Moving a spaceship around
Animating the main menu
Summary
9. Integrating Google Play Services
Setting up the developer console
Setting up the code
Achievements
Architecture
Unlocking achievements
Leaderboards
Opening the Play Games UI
Other features of Google Play services
Events
Quests
Gifts
Saved games
Multiplayer games
Summary
10. To the Big Screen
Project configuration
Testing for Android TV
Declaring a TV Activity
Providing a home screen banner
Declaring it as a game
Declaring Leanback support
Declaring touchscreen capability as not required
Reviewing the manifest
Showing controller instructions
Dealing with overscan
Controller-based navigation
Dialogs and controllers
Beyond this book
Summary
A. API Levels for Android Versions
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜