nb zombie tués

This commit is contained in:
diane 2023-04-18 16:57:07 +02:00
parent a824754b71
commit bf2ee3efd7
1 changed files with 50 additions and 29 deletions

View File

@ -39,6 +39,7 @@ import javax.swing.SpinnerNumberModel;
import javax.swing.JProgressBar; import javax.swing.JProgressBar;
import java.awt.CardLayout; import java.awt.CardLayout;
import javax.swing.JLayeredPane; import javax.swing.JLayeredPane;
import javax.swing.border.CompoundBorder;
@ -66,7 +67,9 @@ public class MaJFrame extends JFrame {
private JPanelDessin panelGrille; private JPanelDessin panelGrille;
private ImageIcon joueurIcon; private ImageIcon joueurIcon;
private JLabel lblJoueur; private JLabel lblJoueur;
private Simulateur sim; private JLabel lblNbZombiesTues;
private JLabel lblNbZombies;
// private Simulateur sim;
@ -95,7 +98,7 @@ public class MaJFrame extends JFrame {
setTitle("Zombicide"); setTitle("Zombicide");
setBackground(new Color(128, 0, 0)); setBackground(new Color(128, 0, 0));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 752, 558); setBounds(100, 100, 1008, 886);
contentPane = new JPanel(); contentPane = new JPanel();
contentPane.setBackground(new Color(128, 0, 0)); contentPane.setBackground(new Color(128, 0, 0));
contentPane.setBorder(new EmptyBorder(2, 2, 2, 2)); contentPane.setBorder(new EmptyBorder(2, 2, 2, 2));
@ -112,7 +115,7 @@ public class MaJFrame extends JFrame {
JButton btnJouer = new JButton("JOUER !"); JButton btnJouer = new JButton("JOUER !");
btnJouer.setForeground(new Color(255, 255, 255)); btnJouer.setForeground(new Color(255, 255, 255));
btnJouer.setBackground(new Color(120, 120, 120)); btnJouer.setBackground(new Color(255, 128, 0));
btnJouer.addActionListener(new ActionListener() { btnJouer.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
clicBoutonJouer(); clicBoutonJouer();
@ -125,9 +128,9 @@ public class MaJFrame extends JFrame {
panelEnsemble.setBorder(null); panelEnsemble.setBorder(null);
contentPane.add(panelEnsemble, BorderLayout.CENTER); contentPane.add(panelEnsemble, BorderLayout.CENTER);
GridBagLayout gbl_panelEnsemble = new GridBagLayout(); GridBagLayout gbl_panelEnsemble = new GridBagLayout();
gbl_panelEnsemble.columnWidths = new int[] {620, 75, 0}; gbl_panelEnsemble.columnWidths = new int[] {835, 66, 75};
gbl_panelEnsemble.rowHeights = new int[]{489, 0}; gbl_panelEnsemble.rowHeights = new int[]{789, 0};
gbl_panelEnsemble.columnWeights = new double[]{0.0, 0.0}; gbl_panelEnsemble.columnWeights = new double[]{0.0, 0.0, 0.0};
gbl_panelEnsemble.rowWeights = new double[]{0.0, Double.MIN_VALUE}; gbl_panelEnsemble.rowWeights = new double[]{0.0, Double.MIN_VALUE};
panelEnsemble.setLayout(gbl_panelEnsemble); panelEnsemble.setLayout(gbl_panelEnsemble);
@ -184,14 +187,14 @@ public class MaJFrame extends JFrame {
panelInfo.setBackground(new Color(95, 95, 95)); panelInfo.setBackground(new Color(95, 95, 95));
GridBagConstraints gbc_panelInfo = new GridBagConstraints(); GridBagConstraints gbc_panelInfo = new GridBagConstraints();
gbc_panelInfo.fill = GridBagConstraints.BOTH; gbc_panelInfo.fill = GridBagConstraints.BOTH;
gbc_panelInfo.gridx = 1; gbc_panelInfo.gridx = 2;
gbc_panelInfo.gridy = 0; gbc_panelInfo.gridy = 0;
panelEnsemble.add(panelInfo, gbc_panelInfo); panelEnsemble.add(panelInfo, gbc_panelInfo);
GridBagLayout gbl_panelInfo = new GridBagLayout(); GridBagLayout gbl_panelInfo = new GridBagLayout();
gbl_panelInfo.columnWidths = new int[] {75}; gbl_panelInfo.columnWidths = new int[] {75};
gbl_panelInfo.rowHeights = new int[] {20, 100, 91, 30, 30, 30, 30, 10, 91, 0}; gbl_panelInfo.rowHeights = new int[] {20, 190, 56, 87, 91, 82, 30, 30, 30, 55, 91, 0};
gbl_panelInfo.columnWeights = new double[]{1.0}; gbl_panelInfo.columnWeights = new double[]{1.0};
gbl_panelInfo.rowWeights = new double[]{0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE}; gbl_panelInfo.rowWeights = new double[]{0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
panelInfo.setLayout(gbl_panelInfo); panelInfo.setLayout(gbl_panelInfo);
lblScore = new JLabel("Scores"); lblScore = new JLabel("Scores");
@ -270,12 +273,30 @@ public class MaJFrame extends JFrame {
gbc_progressBarAttaque.gridy = 1; gbc_progressBarAttaque.gridy = 1;
panelScore.add(progressBarAttaque, gbc_progressBarAttaque); panelScore.add(progressBarAttaque, gbc_progressBarAttaque);
lblNbZombiesTues = new JLabel("nombre de zombies tués :");
lblNbZombiesTues.setForeground(new Color(240, 240, 240));
GridBagConstraints gbc_lblNbZombiesTues = new GridBagConstraints();
gbc_lblNbZombiesTues.anchor = GridBagConstraints.SOUTH;
gbc_lblNbZombiesTues.insets = new Insets(0, 0, 5, 0);
gbc_lblNbZombiesTues.gridx = 0;
gbc_lblNbZombiesTues.gridy = 2;
panelInfo.add(lblNbZombiesTues, gbc_lblNbZombiesTues);
lblNbZombies = new JLabel("x");
lblNbZombies.setForeground(new Color(240, 240, 240));
GridBagConstraints gbc_lblNbZombies = new GridBagConstraints();
gbc_lblNbZombies.anchor = GridBagConstraints.NORTH;
gbc_lblNbZombies.insets = new Insets(0, 0, 5, 0);
gbc_lblNbZombies.gridx = 0;
gbc_lblNbZombies.gridy = 3;
panelInfo.add(lblNbZombies, gbc_lblNbZombies);
//création boutonDeplacer //création boutonDeplacer
GridBagConstraints gbc_btnDeplacer = new GridBagConstraints(); GridBagConstraints gbc_btnDeplacer = new GridBagConstraints();
gbc_btnDeplacer.fill = GridBagConstraints.BOTH; gbc_btnDeplacer.fill = GridBagConstraints.BOTH;
gbc_btnDeplacer.insets = new Insets(0, 0, 5, 0); gbc_btnDeplacer.insets = new Insets(0, 0, 5, 0);
gbc_btnDeplacer.gridx = 0; gbc_btnDeplacer.gridx = 0;
gbc_btnDeplacer.gridy = 2; gbc_btnDeplacer.gridy = 4;
panelInfo.add(btnDeplacer, gbc_btnDeplacer); panelInfo.add(btnDeplacer, gbc_btnDeplacer);
lblDepX = new JLabel("déplacement X"); lblDepX = new JLabel("déplacement X");
@ -285,7 +306,7 @@ public class MaJFrame extends JFrame {
gbc_lblDepX.fill = GridBagConstraints.BOTH; gbc_lblDepX.fill = GridBagConstraints.BOTH;
gbc_lblDepX.insets = new Insets(0, 0, 5, 0); gbc_lblDepX.insets = new Insets(0, 0, 5, 0);
gbc_lblDepX.gridx = 0; gbc_lblDepX.gridx = 0;
gbc_lblDepX.gridy = 3; gbc_lblDepX.gridy = 5;
panelInfo.add(lblDepX, gbc_lblDepX); panelInfo.add(lblDepX, gbc_lblDepX);
deplacementX = new JSpinner(); deplacementX = new JSpinner();
@ -294,7 +315,7 @@ public class MaJFrame extends JFrame {
GridBagConstraints gbc_deplacementX = new GridBagConstraints(); GridBagConstraints gbc_deplacementX = new GridBagConstraints();
gbc_deplacementX.insets = new Insets(0, 0, 5, 0); gbc_deplacementX.insets = new Insets(0, 0, 5, 0);
gbc_deplacementX.gridx = 0; gbc_deplacementX.gridx = 0;
gbc_deplacementX.gridy = 4; gbc_deplacementX.gridy = 6;
panelInfo.add(deplacementX, gbc_deplacementX); panelInfo.add(deplacementX, gbc_deplacementX);
lblDepY = new JLabel("déplacement Y"); lblDepY = new JLabel("déplacement Y");
@ -304,7 +325,7 @@ public class MaJFrame extends JFrame {
gbc_lblDepY.fill = GridBagConstraints.BOTH; gbc_lblDepY.fill = GridBagConstraints.BOTH;
gbc_lblDepY.insets = new Insets(0, 0, 5, 0); gbc_lblDepY.insets = new Insets(0, 0, 5, 0);
gbc_lblDepY.gridx = 0; gbc_lblDepY.gridx = 0;
gbc_lblDepY.gridy = 5; gbc_lblDepY.gridy = 7;
panelInfo.add(lblDepY, gbc_lblDepY); panelInfo.add(lblDepY, gbc_lblDepY);
deplacementY = new JSpinner(); deplacementY = new JSpinner();
@ -313,7 +334,7 @@ public class MaJFrame extends JFrame {
GridBagConstraints gbc_deplacementY = new GridBagConstraints(); GridBagConstraints gbc_deplacementY = new GridBagConstraints();
gbc_deplacementY.insets = new Insets(0, 0, 5, 0); gbc_deplacementY.insets = new Insets(0, 0, 5, 0);
gbc_deplacementY.gridx = 0; gbc_deplacementY.gridx = 0;
gbc_deplacementY.gridy = 6; gbc_deplacementY.gridy = 8;
panelInfo.add(deplacementY, gbc_deplacementY); panelInfo.add(deplacementY, gbc_deplacementY);
//création boutonTuer //création boutonTuer
@ -325,7 +346,7 @@ public class MaJFrame extends JFrame {
GridBagConstraints gbc_btnTuer = new GridBagConstraints(); GridBagConstraints gbc_btnTuer = new GridBagConstraints();
gbc_btnTuer.fill = GridBagConstraints.BOTH; gbc_btnTuer.fill = GridBagConstraints.BOTH;
gbc_btnTuer.gridx = 0; gbc_btnTuer.gridx = 0;
gbc_btnTuer.gridy = 8; gbc_btnTuer.gridy = 10;
panelInfo.add(btnTuer, gbc_btnTuer); panelInfo.add(btnTuer, gbc_btnTuer);
} }
@ -337,19 +358,19 @@ public class MaJFrame extends JFrame {
} }
protected void clicPause() { // protected void clicPause() {
//
{ // {
//
//
protected void clicStart () { // protected void clicStart () {
sim = new Simulateur(100,this); // sim = new Simulateur(100,this);
sim.lancerSimulateur(); // sim.lancerSimulateur();
//
//
} // }
} // }
} // }
} // }
} }