ajout chiffre styler
BIN
CASE/Case.class
@ -13,7 +13,7 @@ public class Case extends JComponent{
|
||||
private int voisin; //Le nombre de mine aux alentours
|
||||
private int suspition; // son Etat de suspition ( 0:pas une bombe, 1:en est une, 2:je doute)
|
||||
// Les Images de la case (point d'interogation, etoile et bombe)
|
||||
private Image interogation, etoile, imgboombe;
|
||||
private Image interogation, etoile, imgboombe, un, deux, trois, quatre, cinq, six, sept, huit;
|
||||
|
||||
//Constructeur de la Case
|
||||
public Case(){
|
||||
@ -27,6 +27,14 @@ public class Case extends JComponent{
|
||||
this.interogation= Toolkit.getDefaultToolkit().getImage("./IMAGE/pointintero.png");
|
||||
this.etoile= Toolkit.getDefaultToolkit().getImage("./IMAGE/etoile.png");
|
||||
this.imgboombe= Toolkit.getDefaultToolkit().getImage("./IMAGE/bombe.png");
|
||||
this.un=Toolkit.getDefaultToolkit().getImage("./IMAGE/un.jpg");
|
||||
this.deux=Toolkit.getDefaultToolkit().getImage("./IMAGE/deux.jpg");
|
||||
this.trois=Toolkit.getDefaultToolkit().getImage("./IMAGE/trois.jpg");
|
||||
this.quatre=Toolkit.getDefaultToolkit().getImage("./IMAGE/quatre.jpg");
|
||||
this.cinq=Toolkit.getDefaultToolkit().getImage("./IMAGE/cinq.jpg");
|
||||
this.six=Toolkit.getDefaultToolkit().getImage("./IMAGE/six.jpg");
|
||||
this.sept=Toolkit.getDefaultToolkit().getImage("./IMAGE/sept.jpg");
|
||||
this.huit=Toolkit.getDefaultToolkit().getImage("./IMAGE/huit.jpg");
|
||||
}
|
||||
|
||||
// Nous mettons les getter/setter
|
||||
@ -112,7 +120,30 @@ public class Case extends JComponent{
|
||||
//si la case a au moins 1 voisin qui est une bombe
|
||||
if(this.voisin>0){
|
||||
//on ecrit le nombre de voisin que elle a
|
||||
secondPinceau.drawString(String.valueOf(voisin), this.getWidth()/2, this.getHeight()/2);
|
||||
if(this.voisin==1){
|
||||
secondPinceau.drawImage(this.un, this.getWidth()/20*5, this.getHeight()/20*5, this.getWidth()/20*10, this.getHeight()/20*10 ,this);
|
||||
}
|
||||
if(this.voisin==2){
|
||||
secondPinceau.drawImage(this.deux, this.getWidth()/20*5, this.getHeight()/20*5, this.getWidth()/20*10, this.getHeight()/20*10 ,this);
|
||||
}
|
||||
if(this.voisin==3){
|
||||
secondPinceau.drawImage(this.trois, this.getWidth()/20*5, this.getHeight()/20*5, this.getWidth()/20*10, this.getHeight()/20*10 ,this);
|
||||
}
|
||||
if(this.voisin==4){
|
||||
secondPinceau.drawImage(this.quatre, this.getWidth()/20*5, this.getHeight()/20*5, this.getWidth()/20*10, this.getHeight()/20*10 ,this);
|
||||
}
|
||||
if(this.voisin==5){
|
||||
secondPinceau.drawImage(this.cinq, this.getWidth()/20*5, this.getHeight()/20*5, this.getWidth()/20*10, this.getHeight()/20*10 ,this);
|
||||
}
|
||||
if(this.voisin==6){
|
||||
secondPinceau.drawImage(this.six, this.getWidth()/20*5, this.getHeight()/20*5, this.getWidth()/20*10, this.getHeight()/20*10 ,this);
|
||||
}
|
||||
if(this.voisin==7){
|
||||
secondPinceau.drawImage(this.sept, this.getWidth()/20*5, this.getHeight()/20*5, this.getWidth()/20*10, this.getHeight()/20*10 ,this);
|
||||
}
|
||||
if(this.voisin==8){
|
||||
secondPinceau.drawImage(this.huit, this.getWidth()/20*5, this.getHeight()/20*5, this.getWidth()/20*10, this.getHeight()/20*10 ,this);
|
||||
}
|
||||
}
|
||||
//si la case est une bombe
|
||||
if(this.bombe==true){
|
||||
|
BIN
CASE/IMAGE/cinq.jpg
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
CASE/IMAGE/deux.jpg
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
CASE/IMAGE/huit.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
CASE/IMAGE/quatre.jpg
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
CASE/IMAGE/sept.jpg
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
CASE/IMAGE/six.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
CASE/IMAGE/trois.jpg
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
CASE/IMAGE/un.jpg
Normal file
After Width: | Height: | Size: 15 KiB |
@ -10,8 +10,8 @@ public class main_ex{
|
||||
public static void main(String[] Args){
|
||||
// on initialise une fenettre
|
||||
JFrame fenetre = new JFrame("Démineur");
|
||||
int ligne=8;
|
||||
int collonne=10;
|
||||
int ligne=30;
|
||||
int collonne=80;
|
||||
fenetre.setLocation(0,0);
|
||||
//on choisi une taille arbitraire
|
||||
fenetre.setSize(1500,800);
|
||||
@ -33,7 +33,7 @@ public class main_ex{
|
||||
}
|
||||
}
|
||||
//nous disposons les bombe dans le jeu
|
||||
plateau.setAllBombe(8, ligne, collonne, tab);
|
||||
plateau.setAllBombe(300, ligne, collonne, tab);
|
||||
//maitenant que les bombe sont mise nous pouvons modifier le nombre de voisin des cases
|
||||
plateau.setAllVoisin(tab);
|
||||
}
|
||||
|