From a32541b39f2ed1eadf2189b31d05416b992e46d3 Mon Sep 17 00:00:00 2001 From: Lorenz Hohmann Date: Thu, 3 Feb 2022 08:30:43 +0100 Subject: [PATCH] Implemented finished random ship positionig method into gui --- .../java/de/tims/fleetstorm/gui/GameLogic.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/de/tims/fleetstorm/gui/GameLogic.java b/src/main/java/de/tims/fleetstorm/gui/GameLogic.java index 2bc34d5..c61cafa 100644 --- a/src/main/java/de/tims/fleetstorm/gui/GameLogic.java +++ b/src/main/java/de/tims/fleetstorm/gui/GameLogic.java @@ -194,10 +194,10 @@ public class GameLogic extends JPanel { // create player matchfield and set ships this.matchfield = new Matchfield(matchfieldSize); this.matchfield.createMatchfield(); - this.matchfield.setShip(new Coordinate(4, 6), 2, 0); - this.matchfield.setShip(new Coordinate(1, 3), 3, 0); - this.matchfield.setShip(new Coordinate(9, 1), 4, 1); - this.matchfield.setShip(new Coordinate(0, 0), 5, 0); + this.matchfield.setShipOnRandomPosition(2); + this.matchfield.setShipOnRandomPosition(3); + this.matchfield.setShipOnRandomPosition(4); + this.matchfield.setShipOnRandomPosition(5); this.aiLogic = new Logic(); this.aiLogic.setMatchfield(this.matchfield); @@ -206,10 +206,10 @@ public class GameLogic extends JPanel { // matchfield) this.enemyMatchfield = new Matchfield(matchfieldSize); this.enemyMatchfield.createMatchfield(); - this.enemyMatchfield.setShip(new Coordinate(8, 9), 2, 0); - this.enemyMatchfield.setShip(new Coordinate(0, 2), 3, 1); - this.enemyMatchfield.setShip(new Coordinate(7, 0), 4, 1); - this.enemyMatchfield.setShip(new Coordinate(3, 6), 5, 0); + this.enemyMatchfield.setShipOnRandomPosition(2); + this.enemyMatchfield.setShipOnRandomPosition(3); + this.enemyMatchfield.setShipOnRandomPosition(4); + this.enemyMatchfield.setShipOnRandomPosition(5); // enter game loop this.gameState = GameLogic.RUNNING;