diff options
author | Nao Pross <naopross@thearcway.org> | 2018-02-10 14:41:49 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-02-10 14:41:49 +0100 |
commit | d677dbead66c2c52c2ffc51a64ece0a06114d2ad (patch) | |
tree | 188a7a6fc693dd47de18648577fba3c247361f2c /src/main/java/Map.java | |
parent | Implement barebone game engine (diff) | |
download | Subconscious-old-d677dbead66c2c52c2ffc51a64ece0a06114d2ad.tar.gz Subconscious-old-d677dbead66c2c52c2ffc51a64ece0a06114d2ad.zip |
Switch to gradle, update gitignore
Diffstat (limited to 'src/main/java/Map.java')
-rw-r--r-- | src/main/java/Map.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main/java/Map.java b/src/main/java/Map.java new file mode 100644 index 0000000..031e922 --- /dev/null +++ b/src/main/java/Map.java @@ -0,0 +1,28 @@ +import java.awt.Dimension; + +public class Map { + + public final Dimension size; + public final Tile grid[]; + + // TODO load map from file + // public Map(File filename) { + public Map(Dimension size) { + this.size = size; + + // populate grid + this.grid = new Tile[this.size.width * this.size.height]; + for (int y = 0; y < this.size.width; y++) { + for (int x = 0; x < this.size.height; x++) { + this.grid[y * this.size.width + x] = new Tile(Tile.Type.GRASS, x, y); + } + } + } + + // public void load() {} + + /* accessors */ + public Tile getTile(int x, int y) { + return this.grid[y * this.size.width + y]; + } +} |