add ship reset position
This commit is contained in:
parent
80b5d8e701
commit
256d769ccf
|
@ -51,7 +51,6 @@ public class Ship {
|
||||||
private String name;
|
private String name;
|
||||||
private int hitsOnMe;
|
private int hitsOnMe;
|
||||||
private boolean sunk;
|
private boolean sunk;
|
||||||
private boolean isPlaced;
|
|
||||||
|
|
||||||
public Ship (int size, String name) {
|
public Ship (int size, String name) {
|
||||||
this.size = size;
|
this.size = size;
|
||||||
|
@ -63,6 +62,10 @@ public class Ship {
|
||||||
this.isPlaced = false;
|
this.isPlaced = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetPosition() {
|
||||||
|
this.position = null;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean setPosition(Point pos, List<Ship> shipsList, int boardSize) {
|
public boolean setPosition(Point pos, List<Ship> shipsList, int boardSize) {
|
||||||
// ueberpruefe boundaries
|
// ueberpruefe boundaries
|
||||||
if (pos.getX() < 0 || pos.getY() < 0 || pos.getX() >= boardSize || pos.getY() >= boardSize) {
|
if (pos.getX() < 0 || pos.getY() < 0 || pos.getX() >= boardSize || pos.getY() >= boardSize) {
|
||||||
|
|
Loading…
Reference in New Issue