diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-03-12 16:05:44 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-03-12 16:05:44 +0300 |
commit | edb54e7cc773d1b9485171e37f59296de52f2031 (patch) | |
tree | f04c0ead1dd5beb4c9dc41b9d86b7183fb859728 | |
parent | 668985e6ed78add10e3a0eb94eff283d59b3971f (diff) | |
download | carcassonne-engine-ts-edb54e7cc773d1b9485171e37f59296de52f2031.tar.gz |
feat: add position to constructor
-rw-r--r-- | src/Tile/Tile.ts | 6 | ||||
-rw-r--r-- | src/Tile/TileOnBoard.ts | 10 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/Tile/Tile.ts b/src/Tile/Tile.ts index 3a2d350..5bc6a7a 100644 --- a/src/Tile/Tile.ts +++ b/src/Tile/Tile.ts @@ -20,7 +20,11 @@ export default class Tile { sides: [Feature, Feature, Feature, Feature]; shield?: boolean; - public constructor(center: Feature, sides: [Feature, Feature, Feature, Feature], shield = false) { + public constructor( + center: Feature, + sides: [Feature, Feature, Feature, Feature], + shield = false + ) { this.center = center; this.sides = sides; this.shield = shield; diff --git a/src/Tile/TileOnBoard.ts b/src/Tile/TileOnBoard.ts index fb0817c..374ae95 100644 --- a/src/Tile/TileOnBoard.ts +++ b/src/Tile/TileOnBoard.ts @@ -16,9 +16,17 @@ export default class TileOnBoard extends Tile { y: number; } - constructor(center: Feature, sides: [Feature, Feature, Feature, Feature], shield = false, orientation = 0) { + constructor( + center: Feature, + sides: [Feature, Feature, Feature, Feature], + shield = false, + position = { x: 0, y: 0 }, + orientation = 0 + ) { super(center, sides, shield); + this.position = position; this.orientation = orientation; + this.neighbors = [null, null, null, null]; } getSide(direction: Direction) { |