add map test
This commit is contained in:
@@ -2,6 +2,7 @@ package netwerkprog.game.client;
|
||||
|
||||
public class Map {
|
||||
private char[][] map;
|
||||
private int tileWidth = 16;
|
||||
|
||||
public Map(int size) {
|
||||
this(size,size);
|
||||
@@ -11,8 +12,30 @@ public class Map {
|
||||
this.map = new char[height][width];
|
||||
}
|
||||
|
||||
public char get(int x, int y) {
|
||||
return this.map[y][x];
|
||||
public void setTileWidth(int tileWidth) {
|
||||
this.tileWidth = tileWidth;
|
||||
}
|
||||
|
||||
public int getTileWidth() {
|
||||
return tileWidth;
|
||||
}
|
||||
|
||||
public char[][] get() {
|
||||
return this.map;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the char at the specified position
|
||||
* @param row the row of the element
|
||||
* @param col the column of the element
|
||||
* @return Character.MIN_VALUE if the element does not exist, the specified element otherwise.
|
||||
*/
|
||||
public char get(int row, int col) {
|
||||
return (row < this.map.length && col < this.map[0].length) ? this.map[row][col] : Character.MIN_VALUE;
|
||||
}
|
||||
|
||||
public Map(char[][] map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user