home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / Gamelication / examples / Boink / Boink.java < prev    next >
Encoding:
Java Source  |  1998-04-15  |  1.0 KB  |  52 lines

  1. /**
  2.  *
  3.  * Boink.java
  4.  * @author    Mark G. Tacchi (mtacchi@next.com) 
  5.  * @version    1.0
  6.  * Feb 23/1996
  7.  *
  8.  * Create a bunch of bouncy balls.  Cool as ice, and easy as pie!
  9.  *
  10.  */
  11.  
  12. import java.awt.Color;
  13. import java.awt.Frame;
  14. import com.next.gt.*;
  15.  
  16. public class Boink extends Gamelication {
  17. public void init() {
  18.   super.init( 320,240 );
  19.   Frame f = new Frame( "Gamelication" );
  20.   f.setSize( 320, 240 );
  21.   f.add( this );
  22.   f.addWindowListener( new WindowDestroyer( f, this ) );
  23.   f.addComponentListener( new WindowResizer( displayManager, this ) );
  24.   f.setResizable( true );
  25.   f.show();
  26.   //
  27.   // cache images
  28.   //
  29.   new ImageManager(this);  
  30.  
  31.   //
  32.   // Create balls
  33.   //
  34.   for (int i= 0; i< 12; i++) {
  35.      actorManager.addActor (new Ball(this));
  36.   } /*init*/ 
  37.  
  38.   //
  39.   // paint background image
  40.   //
  41.   displayManager.setBackgroundTile (getImage( getCodeBase(), "images/background.gif"));
  42.   start();
  43.   run();
  44. } /*init*/
  45.  
  46. public static void main( String[] args ) {
  47.     Boink gamelication = new Boink();
  48.     gamelication.init();
  49. }
  50.  
  51. } /*Boink*/
  52.