Class Diagrams for AlienTilesFigure 13-7 shows a simplified set of class diagrams for AlienTiles. The audio and image classes (e.g., MidisLoader, ClipsLoader, and ImagesLoader) have been edited away, and the less important links between the remaining classes have been pruned back for clarity. Figure 13-7. AlienTiles classes diagram (simplified)
Pausing, resuming, and quitting are controlled via AlienTiles' window listener methods. The frame rate is set to 40 FPS, which is still too fast for the alien sprites; they are slowed down further by code in AlienQuadSprite and AlienAStarSprite. WorldDisplay displays the surface image and the blocks, pickups, and sprites resting on the surface. The tile coordinates for the entities are stored in a WorldItems object, using a TileOccupier object for each one. WorldDisplay acts as a communication layer between the player and the aliens. Figure 13-7 includes a small sprite inheritance hierarchy, rooted at Sprite, which is shown on its own in Figure 13-8. Figure 13-8. The sprite hierarchy in AlienTilesMost of the methods in Sprite are extended or overridden by tile-related methods in its subclasses. Tile coordinates are utilized by the game most of the time, supported by methods in TiledSprite though a sprite's pixel location (maintained by Sprite) is needed when it's being drawn to the screen. The player is represented by a PlayerSprite object. AlienAStarSprite uses the A* JWS (Java Web Start):JWS and other libraries algorithm, which necessitates the TilesPriQueue and TilesList data structure classes; they maintain sequences of TileNode objects.
|