From 754c863e60e34c2f9c1c55ec411224f797bc5a3c Mon Sep 17 00:00:00 2001 From: koneko <67551503+koneko@users.noreply.github.com> Date: Tue, 17 Sep 2024 23:46:44 +0200 Subject: [PATCH] "witches do not lie" --- src/classes/Grid.ts | 24 ++++++++++++++++++++++++ src/classes/Tower.ts | 1 + 2 files changed, 25 insertions(+) create mode 100644 src/classes/Tower.ts diff --git a/src/classes/Grid.ts b/src/classes/Grid.ts index 15c3101..8788799 100644 --- a/src/classes/Grid.ts +++ b/src/classes/Grid.ts @@ -1,9 +1,29 @@ import * as PIXI from "pixi.js"; +import { Tower } from "./Tower.ts"; + +export enum CellType { + Path, + NoBuild, + Build, +} + +export class Cell { + public x: number; + public y: number; + public type: CellType; + public tower: Tower; + constructor(x, y, type) { + this.x = x; + this.y = y; + this.type = type; + } +} export class Grid { public rows: number; public columns: number; public gridObject: PIXI.Container; + public cells: Array; constructor(x, y, width, height, rows, columns) { this.rows = rows; this.columns = columns; @@ -13,6 +33,9 @@ export class Grid { x: x, y: y, }); + for (let index = 0; index < rows * columns; index++) { + // const cell = new Cell(); + } } getPixelScalingFactor() { @@ -24,6 +47,7 @@ export class Grid { gridUnitsToPixels(amount: number): number { return amount * this.getPixelScalingFactor(); } + pixelsToGridUnits(pixels: number): number { return pixels / this.getPixelScalingFactor(); } diff --git a/src/classes/Tower.ts b/src/classes/Tower.ts new file mode 100644 index 0000000..221d44e --- /dev/null +++ b/src/classes/Tower.ts @@ -0,0 +1 @@ +export class Tower {}