Lägg till en fråga ifall man vill starta om vid schackmatt

This commit is contained in:
loveb 2022-05-10 14:58:13 +02:00
parent 8e171a85db
commit 08d004b40b

View File

@ -140,7 +140,11 @@ public class Board extends JPanel implements MouseListener {
if (weCanMove) { if (weCanMove) {
JOptionPane.showMessageDialog(this, "Du står i schack"); JOptionPane.showMessageDialog(this, "Du står i schack");
} else { } else {
JOptionPane.showMessageDialog(this, "Schackmatt"); int choise = JOptionPane.showConfirmDialog(this, "Schackmatt\nVill du starta om?");
if (choise == JOptionPane.YES_OPTION) {
this.pieces = initPieces();
whitesTurn = true;
}
} }
inSchack = true; inSchack = true;
} }