diff --git a/src/linea/Jeu.java b/src/linea/Jeu.java index 6d8d7ca..06baf01 100644 --- a/src/linea/Jeu.java +++ b/src/linea/Jeu.java @@ -20,8 +20,10 @@ public class Jeu implements KeyListener, ActionListener { protected Ligne laligne = new Ligne(); protected Timer horloge; protected JLabel labScore; + protected int score; public Jeu(){ + score = 0; labScore = new JLabel("

score : 0

"); labScore.setBounds(20, 540, 200, 50); ecran.add(labScore); @@ -31,6 +33,7 @@ public class Jeu implements KeyListener, ActionListener { fenetre = new JFrame("Linea"); layout = new CardLayout(); conteneurPrincipal = new JPanel(layout); + score = 0; menu = new MenuPrincipal(this); menuCampagne = new MenuCampagne(this); @@ -103,6 +106,7 @@ public class Jeu implements KeyListener, ActionListener { ecran.setGameOver(false); + score = 0; labScore.setText("

score : 0

"); } @@ -110,6 +114,9 @@ public class Jeu implements KeyListener, ActionListener { public void actionPerformed(ActionEvent e) { ecran.traiterBoucleAnimation(); + score ++; + + labScore.setText("

score : " + score+"

"); // Gestion collision simple if (Math.abs(laligne.getHauteurLigneA(400) - demiCercleAvant.getY()) > 30) { gameOver();