Курсовая работа: Java-гра Тетріс
*
* @author irdis_13
*/
public class TetrisGamePanel extends javax.swing.JPanel implements GamePanel,ActionListener {
private Glass stakan;
private Figure fig = null;
private int score = 0;
private int gameState;
private int[] DELAY = {500, 450, 400, 350, 300, 250, 200, 150, 100, 50};
private int level = 1;
Timer t = new javax.swing.Timer(DELAY[level], this);
public TetrisGamePanel() {
stakan = new Glass();
startNewGame();
t.start();
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
stakan.draw(g);
fig.draw(g);
g.setFont(new Font("Times New Roman", Font.BOLD, 24));
g.setColor(Color.BLACK);
g.drawString("Счет: " + score, 350, 250);
g.drawString("Уровень: " + level, 350, 300);
}
public int getScore() {
return score;
}