36 lines
761 B
Java
36 lines
761 B
Java
/** La classe Score represente le label qui affiche le score
|
|
*
|
|
* @version 1.0
|
|
* @author Tanguy Domergue et Leni Boscher
|
|
*/
|
|
|
|
import java.awt.*;
|
|
import javax.swing.*;
|
|
import java.io.*;
|
|
import java.util.Random;
|
|
|
|
public class Score extends JLabel{
|
|
private int score=0;
|
|
/**
|
|
* Constructeur qui initialise le score
|
|
*/
|
|
public Score(){
|
|
super();
|
|
this.setText("Score : " + this.score);
|
|
Font font = new Font("ARIAL", Font.BOLD, 25);
|
|
this.setFont(font);
|
|
}
|
|
|
|
/**
|
|
* Méthode qui met à jour le score en temps réel
|
|
*/
|
|
public void updateScore(int scr){
|
|
this.score += scr;
|
|
this.setText("Score : " + this.score);
|
|
}
|
|
|
|
public int getScore(){
|
|
return this.score;
|
|
}
|
|
|
|
} |