diff --git a/Jeu.db b/Jeu.db new file mode 100644 index 0000000..d3df823 Binary files /dev/null and b/Jeu.db differ diff --git a/linea/BouleBonus.class b/linea/BouleBonus.class new file mode 100644 index 0000000..6c89d14 Binary files /dev/null and b/linea/BouleBonus.class differ diff --git a/linea/Cercle.class b/linea/Cercle.class new file mode 100644 index 0000000..5508fa2 Binary files /dev/null and b/linea/Cercle.class differ diff --git a/linea/Cercle.java b/linea/Cercle.java index 96564cb..44efb78 100644 --- a/linea/Cercle.java +++ b/linea/Cercle.java @@ -6,6 +6,16 @@ import java.awt.Graphics2D; import java.awt.geom.Arc2D; public class Cercle extends ObjetGraphique{ // il s'agit plutôt d'arcs de cercle + private static final BasicStroke ARC_STROKE = new BasicStroke(5.0f); + private static final double GRAVITE = 0.95; + private static final double POUSSEE = 1.45; + private static final double AMORTISSEMENT = 0.92; + private static final double VITESSE_MIN = -6.5; + private static final double VITESSE_MAX = 6.5; + private static final double BORD_HAUT = 0; + private static final double BORD_BAS = 600; + private final Arc2D.Double arc = new Arc2D.Double(); + // Hérite de la classe ObjetGraphique // Ne pas oublier qu'il y a des propriétés et méthodes reçues par l'héritage @@ -94,11 +104,12 @@ public class Cercle extends ObjetGraphique{ // il s'agit plutôt d'arcs de cercl void Afficher(Graphics g) { // choix de la couleur et de l'épaisseur Graphics2D g2D = (Graphics2D) g; - g2D.setStroke(new BasicStroke(5.0f)); + g2D.setStroke(ARC_STROKE); g.setColor(this.couleur); // dessin de l'arc - g2D.draw(new Arc2D.Double(x-rayon/2, y-rayon, rayon, rayon*2, debut, fin, Arc2D.OPEN)); + arc.setArc(x - rayon / 2.0, y - rayon, rayon, rayon * 2.0, debut, fin, Arc2D.OPEN); + g2D.draw(arc); } // Accesseur pour savoir si le joueur maintient la montée @@ -112,35 +123,31 @@ public class Cercle extends ObjetGraphique{ // il s'agit plutôt d'arcs de cercl //------------------------------------------------------------------------- @Override void Animer() { - double gravite = 0.95; - double poussee = 1.45; - double amortissement = 0.92; - - if (montee==true) { - vitesse -= poussee; + if (montee) { + vitesse -= POUSSEE; } else { - vitesse += gravite; + vitesse += GRAVITE; } // Lissage global pour un ressenti plus régulier. - vitesse *= amortissement; + vitesse *= AMORTISSEMENT; - if (vitesse < -6.5) { - vitesse = -6.5; + if (vitesse < VITESSE_MIN) { + vitesse = VITESSE_MIN; } - if (vitesse > 6.5) { - vitesse = 6.5; + if (vitesse > VITESSE_MAX) { + vitesse = VITESSE_MAX; } depY = vitesse; y += depY; //position - if(y<= 0 + rayon){ - y = 0 + rayon; + if (y <= BORD_HAUT + rayon) { + y = BORD_HAUT + rayon; vitesse = 0; - }else if(y>=600 - rayon){ - y = 600 - rayon; + } else if (y >= BORD_BAS - rayon) { + y = BORD_BAS - rayon; vitesse = 0; } diff --git a/linea/DatabaseConnection.class b/linea/DatabaseConnection.class new file mode 100644 index 0000000..e797871 Binary files /dev/null and b/linea/DatabaseConnection.class differ diff --git a/linea/DatabaseConnection.java b/linea/DatabaseConnection.java index c240af5..45bc90a 100644 --- a/linea/DatabaseConnection.java +++ b/linea/DatabaseConnection.java @@ -270,7 +270,7 @@ public class DatabaseConnection { int niveauxTermines = Math.max(0, niveauMax - 1); return "Campagne\n" - + "Niveau max débloqué : " + niveauMax + + "Niveau max atteint : " + niveauMax + "\nNiveaux terminés : " + niveauxTermines; } } diff --git a/linea/Jeu.class b/linea/Jeu.class new file mode 100644 index 0000000..f314159 Binary files /dev/null and b/linea/Jeu.class differ diff --git a/linea/Jeu.java b/linea/Jeu.java index dce9290..779021f 100644 --- a/linea/Jeu.java +++ b/linea/Jeu.java @@ -39,10 +39,17 @@ public class Jeu implements KeyListener, ActionListener { private int meilleurSansCompte = 0; private int mortsSansCompte = 0; private int tempsSansCompteSec = 0; + private int niveauMaxAtteintSansCompte = 1; private long debutPartieMs = 0; private boolean immortel = false; private final boolean modeCampagne; + private void mettreAJourNiveauMaxSansCompte(int niveau) { + if (idCompte <= 0) { + niveauMaxAtteintSansCompte = Math.max(niveauMaxAtteintSansCompte, niveau); + } + } + private int meilleurActuel() { return idCompte > 0 ? db.getMeilleurScoreParCompte(idCompte) : meilleurSansCompte; } @@ -53,6 +60,7 @@ public class Jeu implements KeyListener, ActionListener { } return "💀 Nombre de morts: " + mortsSansCompte + "\n⏱️ Temps total: " + tempsSansCompteSec + "s" + + "\n📈 Niveau max atteint: " + niveauMaxAtteintSansCompte + "\n🏆 Meilleur score: " + meilleurSansCompte; } @@ -78,6 +86,7 @@ public class Jeu implements KeyListener, ActionListener { this.idCompte = idCompte; this._niv = niveau; this.modeCampagne = modeCampagne; + mettreAJourNiveauMaxSansCompte(_niv); labScore = new JLabel(); labScore.setText("