Beispiel #1
0
  protected void levelFailed(Graphics2D g) {
    try {
      InputStream in = getClass().getResourceAsStream("/sounds/fail.wav");
      m_as = new AudioStream(in);
      AudioPlayer.player.start(m_as);
    } catch (IOException e) {
    }

    _balls--;
    if (_balls == 0) {
      resetGame();
      JOptionPane.showMessageDialog(
          null, "Game Over! Your score was " + _score + " and you reached level " + _level + ".");
    } else {
      _canvas.getBall().resetPosition();
      _canvas.drawField(g);
    }
    repaint();

    _appState = Constants.appStates.Paused;
  }
Beispiel #2
0
 protected Ball getBall() {
   return _canvas.getBall();
 }