Adding increase difficulty

This commit is contained in:
2026-02-23 11:10:15 +01:00
parent 83f5b974ab
commit cd7d63a610
2 changed files with 28 additions and 2 deletions

View File

@@ -147,7 +147,22 @@ public class Jeu implements KeyListener, ActionListener{
public void actionPerformed(ActionEvent e) {
ecran.traiterBoucleAnimation();
if (ecran.aCollision()) {
resetLevel();
if (horloge != null) horloge.stop();
int finalScore = (int) score;
Object[] options = {"Relancer", "Quitter"};
int choix = javax.swing.JOptionPane.showOptionDialog(null,
"Perdu\nScore : " + finalScore,
"Perdu",
javax.swing.JOptionPane.DEFAULT_OPTION,
javax.swing.JOptionPane.INFORMATION_MESSAGE,
null,
options,
options[0]);
if (choix == 0) { // Relancer
resetLevel();
} else {
System.exit(0);
}
return;
}
score+=(0.05+(0.05*horloge.getDelay()/100.0));