Android games programmers now have the power to write games for Android tablets. Beginning Android Tablet Games Programming explains how to enhance your Android games using the new tablet interface and the additional screen estate. You'll learn how to bring your programming skills up to date and into a world where touch screens, games physics, and artificial intelligence come together in new and surprising ways. Beginning Android Tablet Games Programming shows how to quickly and easily set up an Android development environment—in no time at all, you'll be programming away. You'll begin with some simple games using sprites and choreographed movement. Next, you'll learn how to handle user input in the modern age of touch screens and motion. Along the way, you'll discover how to use that extra screen space on a tablet to provide more relaxed and more interesting user interactions in your games. You'll learn how to use sound and music, for instance, to make your application menus more user-friendly. The Android operating system has recently acquired multicore functionality to meet the demands of multicore devices now entering the tablet market. With Beginning Android Tablet Games Programming, you'll discover how to harness that new power with your games programming through more process-demanding and fun techniques, including physics modeling, rich game world representation, artificial intelligence, and multiplayer interactions. Throughout each chapter of Beginning Android Tablet Games Programming, you'll find code that you can add or adapt to your own games to create the components you want. You can also work up to wrapping everything together into a complete Mario-type example game. Finally, when you have your first games ready, learn how developers have released their games and made a profit. You'll find tips on how to present your games in the Android and other application markets, and a solid approach to games marketing and monetization. What you’ll learn How to set up an Android tablet programming environment How to program for touchscreens and other input devices Techniques to take advantage of the extra screen size of a tablet How to take advantage of multicore processing power in your games How to program a multiplayer game How to add artificial intelligence to in-game opponents How to program game modes, game states, and game worlds How to program a complete game About in-app marketing and games monetization Who this book is for This is a book for Java programmers new to Honeycomb, tablets and games programming. An experienced games programmer can also use this book to migrate their existing expertise to the Android and the tablet environment. Table of Contents Setting Up for Android 3.0 Java Development Creating Simple Games with Sprites and Movement Creating Gathering User Input Adding Sounds Effects, Music, and Video One-Player Game with Obstacles A Ball and Paddle Game Building a Two-Player Game A One-Player Strategy Game Part I A One-Player Strategy Game Part II Publishing the Game Testing Android Games on a Real Device
Author(s): Jeremy Kerfs
Edition: 1
Publisher: Apress
Year: 2011
Language: English
Pages: 198
Cover......Page 1
Contents at a Glance......Page 3
Contents......Page 191
About the Author......Page 196
About the Technical Reviewer......Page 197
Acknowledgments......Page 198
The Beginnings of Android......Page 4
Android 3.0 Features......Page 5
What You Need to Know......Page 6
What You Need for a Platform......Page 7
Installing the Java JDK......Page 8
Installing the Eclipse IDE......Page 11
Installing the Android SDK......Page 13
Adding Android Tools and a Virtual Device to Eclipse......Page 18
Putting Your Tools to the Test......Page 21
Creating an Android Project......Page 22
Exploring the Android Project in Eclipse......Page 25
Creating a Virtual Android Device......Page 26
Running the App......Page 27
Making Your First Changes to the App......Page 28
Summary......Page 29
Working with Images......Page 30
Creating a Image Display Surface......Page 31
Rendering an Image......Page 35
Working with Sprites......Page 37
Running a Game......Page 43
Getting a Professional Look......Page 44
Implementing Timing and Complex Motion......Page 45
Detecting Collisions......Page 47
Summary......Page 48
Understanding Tablet Input Options......Page 49
Understanding Tablet Input......Page 50
Responding to Touch......Page 52
Responding to Gestures......Page 55
Using Input Queues......Page 59
Responding to Sensor Data......Page 65
Using Sensor Data......Page 68
Summary......Page 70
Getting Ready for Sounds......Page 71
Finding and Adding Sound Effects......Page 72
Managing Multiple Sound Effects......Page 73
Matching Sound Effects to Events......Page 78
Adding Music......Page 79
Managing Music......Page 80
Summary......Page 88
Planning a One-Player Game: AllTogether......Page 89
Building the One-Player Game......Page 90
Upgrading the Game Sprites......Page 91
Adding a Reward for Winning the Game......Page 94
Tracking the State of Game Sprites......Page 95
Summary......Page 104
Gathering Game Resources......Page 105
Creating a New Project......Page 106
Modifying GameView.java......Page 108
Adding Collision Detection and Event Handling......Page 111
Adding Touch Control of the Paddle......Page 116
Adding Sound......Page 117
Instantiating the Blocks......Page 118
Removing Dead Blocks......Page 120
Summary......Page 121
Understanding Multiplayer Games......Page 123
Multiplayer Games with Peer-to-Peer......Page 124
Choosing a Multiplayer Method......Page 125
Adding Bluetooth Connections......Page 126
Managing Bluetooth Connections......Page 130
Adapting the Game Code for Two Players......Page 137
Summary......Page 138
A One-Player Strategy Game......Page 139
Assembling Harbor Defender......Page 140
Constructing the Pier......Page 141
Adding the Ground and Castle......Page 144
Creating the Boats......Page 145
Adding Cannons......Page 147
Adding Images......Page 148
Debugging Harbor Defender......Page 149
Summary......Page 151
A One-Player Strategy Game......Page 152
Enhancing the Game Sprites......Page 153
Creating the User Controls......Page 154
Putting Everything on the Screen......Page 159
Deploying and Managing the Attack Boats......Page 160
Firing the Cannons......Page 161
Managing Game Outcomes......Page 164
Analyzing the Game......Page 166
Summary......Page 167
Adding an Splash Screen......Page 168
Responding to a Start Game Button Press......Page 171
Packaging the Game......Page 172
Deploying the Game......Page 175
Opening a Google Developer Account......Page 177
Marketing Your Game......Page 178
Summary......Page 179
Testing Android Games on a Real Device......Page 180
B......Page 182
E......Page 183
J......Page 184
O......Page 185
S......Page 186
T......Page 187
X, Y, Z......Page 188