The Bug Starts RunningBugRunner 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.
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. |