summaryrefslogtreecommitdiffstats
path: root/src/de/gamezock/metacraft/data/Map.java
blob: c6d306bf882ee466c615e0817d432537f1b95039 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package de.gamezock.metacraft.data;


public class Map {
  Tile[][] tiles;
  private float[][] heightmap;
  
  
	public Map() {
	  int width = 5;
	  int height = 5;
	  
	  heightmap = new float[width][height];
	  tiles = new Tile[width][height];
	  
	  for(int i = 0; i < width; ++i) {
	    for(int j = 0; j < height; ++j) {
	      //heightmap[i][j] = ((i-2)*(i-2)+(j-2)*(j-2))*0.5f;
	      heightmap[i][j] = 0;
	      tiles[i][j] = new Tile(new TestTile());
	    }
	  }
	}
	
	public Tile getTile(int x, int y) {
	  return tiles[x][y];
	}
	
	public float getTileHeight(int x, int y) {
	  return heightmap[x][y];
	}
	
	public int getWidth() {
	  return heightmap.length;
	}
	
	public int getHeight() {
	  return heightmap[0].length;
	}
	
	public int getTileSize() {
	  return tiles[0][0].getData().getSize();
	}
}