示例#1
0
  /** Constructor */
  public GameManager(MainGameFrame mgf1) {
    // to be able to reach main menu from the game we need to pass it to the actual game manager to
    // know its caller.
    mgf = mgf1;

    setSize(GAME_WIDTH, GAME_HEIGHT);
    addKeyListener(new TAdapter());
    addKeyListener(new PauseAdapter(this));
    setFocusable(true);
    setBackground(Color.CYAN);
    setDoubleBuffered(true);

    // ingame = true;
    pauseFlag = false;
    nextLevelFlag = false;
    directionKeysFlag = mgf.getControls();
    difficultyFlag = mgf.getDifficulty();
    currentLevel = 1;

    // Init game objects
    wind = WindManager.getInstance(); // Initialize singleton WindManager class
    boat = new Boat(0, 20);

    initGame();
    // gamePoint = 0;

    // Init Timer
    timer = new Timer(40, this);
    startTimer();
  }