From fdfe6d7bb18a1df7bb8710952a7c2506b606fca3 Mon Sep 17 00:00:00 2001 From: sigmasternchen Date: Tue, 29 Oct 2024 21:26:47 +0100 Subject: [PATCH] some positioning stuff --- html/static/styles.css | 4 +++- src/game/Banner.ts | 2 ++ src/game/Position.ts | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/html/static/styles.css b/html/static/styles.css index 29f71c5..7626369 100644 --- a/html/static/styles.css +++ b/html/static/styles.css @@ -1,10 +1,12 @@ #game { - width: 500px; + width: 1000px; height: 500px; background-color: red; + position: relative; } .banner { margin: 1px; + position: absolute; } \ No newline at end of file diff --git a/src/game/Banner.ts b/src/game/Banner.ts index bdce7d8..bed4359 100644 --- a/src/game/Banner.ts +++ b/src/game/Banner.ts @@ -14,6 +14,8 @@ export class Banner { this.element = document.createElement("img"); this.element.classList.add("banner"); + this.element.style.top = this.position.y + "px"; + this.element.style.left = this.position.x + "px"; } public load(): Promise { diff --git a/src/game/Position.ts b/src/game/Position.ts index afc78f8..eb4cb5e 100644 --- a/src/game/Position.ts +++ b/src/game/Position.ts @@ -7,4 +7,12 @@ export class Position { this._x = x; this._y = y; } + + get x(): number { + return this._x; + } + + get y(): number { + return this._y; + } } \ No newline at end of file