Game Development Reference
In-Depth Information
What's Next?
In this chapter, we looked at the polygon-based game Asteroids. This game presented new challenges
due to the lack of polygon support in the Android API. To overcome this limitation, we created two
helper classes: Rectangle and Polygon . This code has been ported from the Java SE API and slightly
modified for this game. You also learned how to build a PolygonSprite capable of remembering X and Y
coordinates and an angle of rotation. PolygonSprite is also capable of detecting collisions with other
PolygonSprite s and drawing itself in the Android canvas.
With these classes, we have built the arcade classic Asteroids. Furthermore, we have looked at the
game's inner workings such as a user-defined XML layout and manipulation of game resources such as
audio files and icons.
You have also taken a look at the critical steps in the game life cycle: initialization, drawing, and
updating physics, as well as the caveats of drawing the polygons in the Android canvas. Finally, you
learned at how to process key and touch events, and you tested Asteroids in the emulator.
I hope that you have learned new interesting techniques in building pure Java games. In the
following chapters, I switch gears to concentrate in hybrid games, which mix Java and C thru JNI for
maximum performance. We'll begin with the always-interesting subject of OpenGL.
Search WWH ::




Custom Search