Bats, Balls, and Sprites


Chapter 11. Sprites

A game's active entities are often encoded as sprites. A sprite is a moving graphical object, which may represent the player (and so respond to key presses and mouse actions) or may be driven by "intelligent" code in the game. The Sprite class developed in this chapter holds a sprite's position, its speed (coded as incremental steps in the x and y directions), and it uses the image classes (ImagesLoader, ImagesPlayer) from Chapter 6 to manage its graphical presence. Sprite's subclasses add user and environmental interactions and audio effects. The coding of these classes is helped by specifying them first with UML statecharts.

Many elements are utilized from earlier chapters: the animation framework from Chapters 2 and 3, the image loader classes from Chapter 6, and the audio loaders from Chapter 8.




Killer Game Programming in Java
Killer Game Programming in Java
ISBN: 0596007302
EAN: 2147483647
Year: 2006
Pages: 340

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net