/** * Реализация интерфейса ActionListener * * @param e */ public void actionPerformed(ActionEvent e) { if (level.levelIsDone()) { level.levelStop(); JOptionPane.showMessageDialog(null, "Level done, you scores: " + level.getPlayerScores()); if (levelManager.isNext()) { level = levelManager.next(); } else { gameTimer.stop(); JOptionPane.showMessageDialog(null, "Game is done!"); System.exit(1); } } else { level.tick(); } repaint(); }
public GameScreen() { level = levelManager.first(); addKeyListener(new GameKeyAdapter()); setFocusable(true); gameTimer.start(); }