blades-engine handle wall types
This commit is contained in:
@@ -2,6 +2,16 @@ package data.blades;
|
||||
|
||||
typedef TileArray<T> = Array<Array<T>>;
|
||||
|
||||
typedef TownDetails = {
|
||||
wallSheet1:Int,
|
||||
wallSheet2:Int
|
||||
};
|
||||
|
||||
enum MapType {
|
||||
Town(details:TownDetails);
|
||||
Outdoors(underground:Bool);
|
||||
}
|
||||
|
||||
class TileMap {
|
||||
// TODO might need encapsulation
|
||||
public var floorCodes:TileArray<Int>;
|
||||
@@ -17,15 +27,32 @@ class TileMap {
|
||||
return [for (x in 0...width) [for (y in 0...height) defaultValue]];
|
||||
}
|
||||
|
||||
public function new(width, height, name) {
|
||||
public function wallSheet(num:Int) {
|
||||
return switch (type) {
|
||||
case Town(det):
|
||||
if (num == 1)
|
||||
det.wallSheet1;
|
||||
else
|
||||
det.wallSheet2;
|
||||
case Outdoors(true):
|
||||
614;
|
||||
case Outdoors(false):
|
||||
616;
|
||||
};
|
||||
}
|
||||
|
||||
public function new(width, height, name, type) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.name = name;
|
||||
floorCodes = tileArray(255);
|
||||
terrainCodes = tileArray(0);
|
||||
floorHeights = tileArray(9);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public var type:MapType;
|
||||
|
||||
public function setFloor(x, y, code) {
|
||||
floorCodes[x][y] = code;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user