update:Boule
This commit is contained in:
BIN
linea/BouleBonus.class
Normal file
BIN
linea/BouleBonus.class
Normal file
Binary file not shown.
BIN
linea/Cercle.class
Normal file
BIN
linea/Cercle.class
Normal file
Binary file not shown.
@@ -6,6 +6,16 @@ import java.awt.Graphics2D;
|
|||||||
import java.awt.geom.Arc2D;
|
import java.awt.geom.Arc2D;
|
||||||
|
|
||||||
public class Cercle extends ObjetGraphique{ // il s'agit plutôt d'arcs de cercle
|
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
|
// 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
|
// 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) {
|
void Afficher(Graphics g) {
|
||||||
// choix de la couleur et de l'épaisseur
|
// choix de la couleur et de l'épaisseur
|
||||||
Graphics2D g2D = (Graphics2D) g;
|
Graphics2D g2D = (Graphics2D) g;
|
||||||
g2D.setStroke(new BasicStroke(5.0f));
|
g2D.setStroke(ARC_STROKE);
|
||||||
g.setColor(this.couleur);
|
g.setColor(this.couleur);
|
||||||
|
|
||||||
// dessin de l'arc
|
// 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
|
// 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
|
@Override
|
||||||
void Animer() {
|
void Animer() {
|
||||||
double gravite = 0.95;
|
if (montee) {
|
||||||
double poussee = 1.45;
|
vitesse -= POUSSEE;
|
||||||
double amortissement = 0.92;
|
|
||||||
|
|
||||||
if (montee==true) {
|
|
||||||
vitesse -= poussee;
|
|
||||||
} else {
|
} else {
|
||||||
vitesse += gravite;
|
vitesse += GRAVITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lissage global pour un ressenti plus régulier.
|
// Lissage global pour un ressenti plus régulier.
|
||||||
vitesse *= amortissement;
|
vitesse *= AMORTISSEMENT;
|
||||||
|
|
||||||
if (vitesse < -6.5) {
|
if (vitesse < VITESSE_MIN) {
|
||||||
vitesse = -6.5;
|
vitesse = VITESSE_MIN;
|
||||||
}
|
}
|
||||||
if (vitesse > 6.5) {
|
if (vitesse > VITESSE_MAX) {
|
||||||
vitesse = 6.5;
|
vitesse = VITESSE_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
depY = vitesse;
|
depY = vitesse;
|
||||||
y += depY;
|
y += depY;
|
||||||
|
|
||||||
//position
|
//position
|
||||||
if(y<= 0 + rayon){
|
if (y <= BORD_HAUT + rayon) {
|
||||||
y = 0 + rayon;
|
y = BORD_HAUT + rayon;
|
||||||
vitesse = 0;
|
vitesse = 0;
|
||||||
}else if(y>=600 - rayon){
|
} else if (y >= BORD_BAS - rayon) {
|
||||||
y = 600 - rayon;
|
y = BORD_BAS - rayon;
|
||||||
vitesse = 0;
|
vitesse = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
linea/DatabaseConnection.class
Normal file
BIN
linea/DatabaseConnection.class
Normal file
Binary file not shown.
@@ -270,7 +270,7 @@ public class DatabaseConnection {
|
|||||||
int niveauxTermines = Math.max(0, niveauMax - 1);
|
int niveauxTermines = Math.max(0, niveauMax - 1);
|
||||||
|
|
||||||
return "Campagne\n"
|
return "Campagne\n"
|
||||||
+ "Niveau max débloqué : " + niveauMax
|
+ "Niveau max atteint : " + niveauMax
|
||||||
+ "\nNiveaux terminés : " + niveauxTermines;
|
+ "\nNiveaux terminés : " + niveauxTermines;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
linea/Jeu.class
Normal file
BIN
linea/Jeu.class
Normal file
Binary file not shown.
@@ -39,10 +39,17 @@ public class Jeu implements KeyListener, ActionListener {
|
|||||||
private int meilleurSansCompte = 0;
|
private int meilleurSansCompte = 0;
|
||||||
private int mortsSansCompte = 0;
|
private int mortsSansCompte = 0;
|
||||||
private int tempsSansCompteSec = 0;
|
private int tempsSansCompteSec = 0;
|
||||||
|
private int niveauMaxAtteintSansCompte = 1;
|
||||||
private long debutPartieMs = 0;
|
private long debutPartieMs = 0;
|
||||||
private boolean immortel = false;
|
private boolean immortel = false;
|
||||||
private final boolean modeCampagne;
|
private final boolean modeCampagne;
|
||||||
|
|
||||||
|
private void mettreAJourNiveauMaxSansCompte(int niveau) {
|
||||||
|
if (idCompte <= 0) {
|
||||||
|
niveauMaxAtteintSansCompte = Math.max(niveauMaxAtteintSansCompte, niveau);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int meilleurActuel() {
|
private int meilleurActuel() {
|
||||||
return idCompte > 0 ? db.getMeilleurScoreParCompte(idCompte) : meilleurSansCompte;
|
return idCompte > 0 ? db.getMeilleurScoreParCompte(idCompte) : meilleurSansCompte;
|
||||||
}
|
}
|
||||||
@@ -53,6 +60,7 @@ public class Jeu implements KeyListener, ActionListener {
|
|||||||
}
|
}
|
||||||
return "💀 Nombre de morts: " + mortsSansCompte
|
return "💀 Nombre de morts: " + mortsSansCompte
|
||||||
+ "\n⏱️ Temps total: " + tempsSansCompteSec + "s"
|
+ "\n⏱️ Temps total: " + tempsSansCompteSec + "s"
|
||||||
|
+ "\n📈 Niveau max atteint: " + niveauMaxAtteintSansCompte
|
||||||
+ "\n🏆 Meilleur score: " + meilleurSansCompte;
|
+ "\n🏆 Meilleur score: " + meilleurSansCompte;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,6 +86,7 @@ public class Jeu implements KeyListener, ActionListener {
|
|||||||
this.idCompte = idCompte;
|
this.idCompte = idCompte;
|
||||||
this._niv = niveau;
|
this._niv = niveau;
|
||||||
this.modeCampagne = modeCampagne;
|
this.modeCampagne = modeCampagne;
|
||||||
|
mettreAJourNiveauMaxSansCompte(_niv);
|
||||||
labScore = new JLabel();
|
labScore = new JLabel();
|
||||||
labScore.setText("<html><h3>score : 0</h3></html>");
|
labScore.setText("<html><h3>score : 0</h3></html>");
|
||||||
|
|
||||||
@@ -260,6 +269,7 @@ public class Jeu implements KeyListener, ActionListener {
|
|||||||
meilleurSansCompte = 0;
|
meilleurSansCompte = 0;
|
||||||
mortsSansCompte = 0;
|
mortsSansCompte = 0;
|
||||||
tempsSansCompteSec = 0;
|
tempsSansCompteSec = 0;
|
||||||
|
niveauMaxAtteintSansCompte = Math.max(1, _niv);
|
||||||
} else {
|
} else {
|
||||||
idCompte = db.getIdParPseudo(choix);
|
idCompte = db.getIdParPseudo(choix);
|
||||||
}
|
}
|
||||||
@@ -444,6 +454,7 @@ public class Jeu implements KeyListener, ActionListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_niv = nouveauNiveau;
|
_niv = nouveauNiveau;
|
||||||
|
mettreAJourNiveauMaxSansCompte(_niv);
|
||||||
resetLevel();
|
resetLevel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -509,6 +520,7 @@ public class Jeu implements KeyListener, ActionListener {
|
|||||||
int nouveauNiveau = choisirNouveauNiveau();
|
int nouveauNiveau = choisirNouveauNiveau();
|
||||||
if (nouveauNiveau > 0) {
|
if (nouveauNiveau > 0) {
|
||||||
_niv = nouveauNiveau;
|
_niv = nouveauNiveau;
|
||||||
|
mettreAJourNiveauMaxSansCompte(_niv);
|
||||||
resetLevel();
|
resetLevel();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
linea/Ligne.class
Normal file
BIN
linea/Ligne.class
Normal file
Binary file not shown.
BIN
linea/LineaAppli$SelectionJeu.class
Normal file
BIN
linea/LineaAppli$SelectionJeu.class
Normal file
Binary file not shown.
BIN
linea/LineaAppli.class
Normal file
BIN
linea/LineaAppli.class
Normal file
Binary file not shown.
@@ -237,6 +237,8 @@ public class LineaAppli {
|
|||||||
// Classe de base de l'application, rien à modifier ici
|
// Classe de base de l'application, rien à modifier ici
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
public static void main(String[] arg) {
|
public static void main(String[] arg) {
|
||||||
|
UIManager.put("OptionPane.yesButtonText", "Oui");
|
||||||
|
UIManager.put("OptionPane.noButtonText", "Non");
|
||||||
UIManager.put("OptionPane.cancelButtonText", "Retour");
|
UIManager.put("OptionPane.cancelButtonText", "Retour");
|
||||||
|
|
||||||
DatabaseConnection db = new DatabaseConnection();
|
DatabaseConnection db = new DatabaseConnection();
|
||||||
|
|||||||
BIN
linea/ObjetGraphique.class
Normal file
BIN
linea/ObjetGraphique.class
Normal file
Binary file not shown.
BIN
linea/Segment.class
Normal file
BIN
linea/Segment.class
Normal file
Binary file not shown.
BIN
linea/ZoneDessin.class
Normal file
BIN
linea/ZoneDessin.class
Normal file
Binary file not shown.
@@ -114,7 +114,7 @@ public class ZoneDessin extends JPanel {
|
|||||||
int intervalleBoule = (int) Math.round(intervalleBouleBase - progression * 20.0); // ~165 -> 145
|
int intervalleBoule = (int) Math.round(intervalleBouleBase - progression * 20.0); // ~165 -> 145
|
||||||
double probaVerteBase = 0.35 - progression * 0.06; // ~35% -> 29%
|
double probaVerteBase = 0.35 - progression * 0.06; // ~35% -> 29%
|
||||||
double variationAleatoire = (Math.random() - 0.5) * 0.10; // +/- 5%
|
double variationAleatoire = (Math.random() - 0.5) * 0.10; // +/- 5%
|
||||||
double probaVerte = Math.max(0.22, Math.min(0.45, probaVerteBase + variationAleatoire));
|
double probaVerte = Math.max(0.24, Math.min(0.47, probaVerteBase + variationAleatoire + 0.02));
|
||||||
|
|
||||||
compteurBoule++;
|
compteurBoule++;
|
||||||
if (compteurBoule >= intervalleBoule && ligneObjet != null) {
|
if (compteurBoule >= intervalleBoule && ligneObjet != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user