From 57f032e03bdacecc9b12066ec4698b662fb0c3da Mon Sep 17 00:00:00 2001 From: Thoumi Ngonga Brice Date: Wed, 8 Feb 2023 16:25:50 +0100 Subject: [PATCH] Update Methode void BuildGui and class NewGameListener --- src/main/java/BattleShip/BShip.java | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/main/java/BattleShip/BShip.java b/src/main/java/BattleShip/BShip.java index 57d1df7..df2e30f 100644 --- a/src/main/java/BattleShip/BShip.java +++ b/src/main/java/BattleShip/BShip.java @@ -97,6 +97,33 @@ public class BShip { grid1 = null; grid2 = null; shipsPlaced = false; + + //Set new game grid size to selected dimensions. + + if(a.getSource() == boardSize[0]) { + rows = 8; + columns = 8; + } + + if(a.getSource() == boardSize[1]) { + rows = 10; + columns = 10; + } + + if(a.getSource() == boardSize[2]) { + rows = 12; + columns = 12; + } + + //Determine whether auto placement selected. + + if(a.getSource() == auto) { + autoPlacement = true; + } else { + autoPlacement = false; + } + + startGame(); } }