The Animation Framework


The Bug Starts Running

BugRunner fixes the frame rate to be 40 FPS; anything faster makes it almost impossible to move the ant quickly enough to intercept a dropping ball.

The application's constructor loads and starts the BladeRunner sequence:

     // load the background MIDI sequence     midisLoader = new MidisLoader( );     midisLoader.load("br", "blade_runner.mid");     midisLoader.play("br", true);   // repeatedly play it

Since BugRunner plays one sequence at a time, it's loaded directly via a call to load( ) rather than being specified in a MIDI information file. MidisLoader assumes the sequence is in the Sounds/ subdirectory.

Using a well-known piece of music, like the BladeRunner theme, is a bad idea for a game intended for widespread distribution. The thorny issue of copyright is bound to come up. I've thrown caution to the wind since BladeRunner is one of my favorite sci-fi movies, and the music is great.


BugRunner sets up window listener methods for pausing and resuming the game in a similar manner to the WormChase application in Chapter 3. windowClosing( ) is different:

     public void windowClosing(WindowEvent e)     {  bp.stopGame( );             midisLoader.close( );     }

The call to close( ) in MidisLoader ensures the sequence is stopped at termination time.



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