From edb54e7cc773d1b9485171e37f59296de52f2031 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 12 Mar 2022 16:05:44 +0300 Subject: feat: add position to constructor --- src/Tile/Tile.ts | 6 +++++- 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) { -- cgit v1.2.3