Exemplo n.º 1
0
  // The main method which starts the program. Goes in a loop while the window is still open and
  // while in the loop it displays certain JPanels depending on the variable mode
  public static void main(String[] args) {
    // Creates a Bomberman object
    Bomberman bomberman = new Bomberman();

    // Loads all the images and sprites
    bomberman.load();

    // Loops while the window is open
    while (window.isVisible()) {
      // Depending on mode, a certain JPanel will be made visible by calling a method
      switch (mode) {
        case 1:
          bomberman.options();
          break;
        case 2:
          bomberman.rules();
          break;
        case 3:
          bomberman.controls();
          break;
        case 4:
          bomberman.credits();
          break;
        case 5:
          if (game) bomberman.newGame();
          break;
      }
    }
  }