Game Development Reference
In-Depth Information
Figure 3-2. Space Blaster running on the emulator
Let's take a look at the class hierarchy for this application.
Understanding Game Architecture
Space Blaster is a relatively simple game. It has three main classes:
SpaceBlaster.java : This is the main activity that bonds the game code with the
Android platform. Its job is to load the game layout and process Activity events.
SpaceBlasterGame.java : This is where all the meat resides. This class has all the
game logic, and it processes key and touch events. SpaceBlasterGame extends
ArcadeGame .
ArcadeGame.java : This abstract class encapsulates common functionality. It also
uses a standard Java TimerTask to define a game loop, which will repeat itself
infinitely until the user quits the application.
These classes interact with each other and local resources as shown in Figure 3-3.
Search WWH ::




Custom Search