Skip to Main Content
Killer Game Programming in Java
book

Killer Game Programming in Java

by Andrew Davison
May 2005
Intermediate to advanced content levelIntermediate to advanced
998 pages
26h
English
O'Reilly Media, Inc.
Content preview from Killer Game Programming in Java

Class Diagrams for AlienTiles

Figure 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.

AlienTiles classes diagram (simplified)

Figure 13-7. AlienTiles classes diagram (simplified)

Tip

The AlienTiles JFrame and the AlienTilesPanel JPanel implement the windowed animation framework introduced in Chapters 2 and 3, BugRunner of Chapter 11, and JumpingJack of Chapter 12 use the same technique.

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.

The sprite hierarchy in AlienTiles

Figure 13-8. The sprite hierarchy in AlienTiles

Most of the methods in Sprite are extended ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Game Development with LibGDX: From Beginner to Professional

Java Game Development with LibGDX: From Beginner to Professional

Lee Stemkoski

Publisher Resources

ISBN: 0596007302Supplemental ContentErrata Page