init: resolve conflicts
This commit is contained in:
@@ -62,6 +62,10 @@ public class Jeu implements KeyListener, ActionListener{
|
||||
// Constructeur de la classe
|
||||
//-------------------------------------------------------------------------
|
||||
public Jeu(int utilisateurId){
|
||||
// Créer les tables de la base de données si elles n'existent pas
|
||||
GestionBDD.creerTableUtilisateurSiAbsente();
|
||||
GestionBDD.creerTableScoreSiAbsente();
|
||||
|
||||
JFrame fenetre = new JFrame();
|
||||
|
||||
this.utilisateurId = utilisateurId;
|
||||
@@ -84,13 +88,14 @@ public class Jeu implements KeyListener, ActionListener{
|
||||
|
||||
if( n1 != null ){
|
||||
try {
|
||||
// On charge l'mage du niveau 1
|
||||
// On charge l'image du niveau 1
|
||||
java.net.URL url = Jeu.class.getResource("/" + n1.getImage());
|
||||
if(url != null){
|
||||
java.awt.Image img = javax.imageio.ImageIO.read(url);
|
||||
premierFond = new Background(img);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,6 +243,18 @@ public class Jeu implements KeyListener, ActionListener{
|
||||
this.dernierSegmentValide = null;
|
||||
this.ecran.partiePerdue = false;
|
||||
|
||||
// Formule : Gravité de base - (Niveau * incrément)
|
||||
// Niveau 1 : 10.0 + (1 * 1.50) = 8.5 (poids normal)
|
||||
// Niveau 4 : 10.0 + (4 * 1.50) = 4.0 (Très léger et plane)
|
||||
double graviteNiveau = 10.0 - (this.niveauEnCours.getId() * 1.5);
|
||||
// Sécurité: La gravité du niveau ne doit pas descendre en dessous de 2
|
||||
// Sinon le cercle ne retomberait plus jamais
|
||||
if(graviteNiveau < 2.0){
|
||||
graviteNiveau = 2.0;
|
||||
}
|
||||
this.demiCercleAvant.setGravite(graviteNiveau);
|
||||
this.demiCercleArriere.setGravite(graviteNiveau);
|
||||
|
||||
|
||||
// On corse le jeu avec son ID
|
||||
//On applique les paramètres aux options de jeu
|
||||
@@ -271,7 +288,7 @@ public class Jeu implements KeyListener, ActionListener{
|
||||
|
||||
// Petite pause avec un message
|
||||
horloge.stop();
|
||||
JOptionPane.showMessageDialog(fenetre, "Niveau terminé ! Préparez-vous pour le niveau suivant ;)");
|
||||
JOptionPane.showMessageDialog(fenetre, "Niveau terminé ! Préparez-vous pour le niveau suivant 😉 OU PERDEZ 😈");
|
||||
|
||||
chargerNiveau(idNiveauActuel);
|
||||
horloge.start();
|
||||
@@ -289,11 +306,14 @@ public class Jeu implements KeyListener, ActionListener{
|
||||
this.ecran.traiterBoucleAnimation();
|
||||
this.laLigne.actualiserSegCourant();
|
||||
|
||||
// Mode triche : centrer le cercle sur le milieu du segment courant
|
||||
// Mode triche : Le cercle suit la ligne
|
||||
// On utilisera le calcul pour déterminer si la ligne traverse le cercle
|
||||
if (modeTriche && this.laLigne.getSegCourant() != null) {
|
||||
double milieuY = this.laLigne.getSegCourant().getMilieuY();
|
||||
this.demiCercleAvant.y = milieuY;
|
||||
this.demiCercleArriere.y = milieuY;
|
||||
// double yPoint = this.getSegCourant().y + (this.SegCourant.yLong / this.SegCourant.xLong) * (this.xCercle - this.SegCourant.x);
|
||||
double yPointTricheArrire = this.laLigne.getSegCourant().getY() + (this.laLigne.getSegCourant().getYLong() / this.laLigne.getSegCourant().getXLong()) * (this.demiCercleArriere.getX() - this.laLigne.getSegCourant().getX());
|
||||
double yPointTricheAvant = this.laLigne.getSegCourant().getY() + (this.laLigne.getSegCourant().getYLong() / this.laLigne.getSegCourant().getXLong()) * (this.demiCercleAvant.getX() - this.laLigne.getSegCourant().getX());
|
||||
this.demiCercleAvant.y = yPointTricheArrire ;
|
||||
this.demiCercleArriere.y = yPointTricheAvant;
|
||||
}
|
||||
|
||||
// 2. On vérifie si la ligne traverse bien le cercle
|
||||
|
||||
Reference in New Issue
Block a user