From 647276be0daea54aaa0c3f228c4c1b189d7de8be Mon Sep 17 00:00:00 2001 From: matthew-java Date: Sat, 14 Feb 2026 21:25:31 +0100 Subject: [PATCH] Score fonctionnelle --- src/linea/Jeu.java | 7 +++++++ 1 file changed, 7 insertions(+) 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();