From 00fba129e422c0f19d9f32f967fd35f84fe1b0ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjist=C3=B3f?= Date: Mon, 25 Apr 2016 21:33:09 +0200 Subject: [PATCH] added getters & setters to Tile.x and Tile.y attributes --- cicaprojekt/Tile.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cicaprojekt/Tile.java b/cicaprojekt/Tile.java index d6376d3..37b93ed 100644 --- a/cicaprojekt/Tile.java +++ b/cicaprojekt/Tile.java @@ -8,13 +8,28 @@ public abstract class Tile { protected Map adjacentTile; protected ZPM zpmOnTile; protected Stack boxStack; - protected int x, y; + protected int y = -666; + protected int x = -666; public Tile() { adjacentTile = new HashMap(); } + public int getX() { return this.x; } + + public int getY() { return this.y; } + + public void setX(int x) { + if (x >= 0) + this.x = x; + } + + public void setY(int y) { + if (y >= 0) + this.y = y; + } + public Tile getAdjacentTile(Direction direction) { return adjacentTile.get(direction); }