Score fonctionnelle
This commit is contained in:
@@ -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("<html><h3>score : 0</h3></html>");
|
||||
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("<html><h3>score : 0</h3></html>");
|
||||
}
|
||||
|
||||
@@ -110,6 +114,9 @@ public class Jeu implements KeyListener, ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ecran.traiterBoucleAnimation();
|
||||
|
||||
score ++;
|
||||
|
||||
labScore.setText("<html><h3>score : " + score+"</h3></html>");
|
||||
// Gestion collision simple
|
||||
if (Math.abs(laligne.getHauteurLigneA(400) - demiCercleAvant.getY()) > 30) {
|
||||
gameOver();
|
||||
|
||||
Reference in New Issue
Block a user