some positioning stuff

This commit is contained in:
sigmasternchen 2024-10-29 21:26:47 +01:00
parent 446c0343e1
commit fdfe6d7bb1
3 changed files with 13 additions and 1 deletions

View file

@ -1,10 +1,12 @@
#game { #game {
width: 500px; width: 1000px;
height: 500px; height: 500px;
background-color: red; background-color: red;
position: relative;
} }
.banner { .banner {
margin: 1px; margin: 1px;
position: absolute;
} }

View file

@ -14,6 +14,8 @@ export class Banner {
this.element = document.createElement("img"); this.element = document.createElement("img");
this.element.classList.add("banner"); this.element.classList.add("banner");
this.element.style.top = this.position.y + "px";
this.element.style.left = this.position.x + "px";
} }
public load(): Promise<void> { public load(): Promise<void> {

View file

@ -7,4 +7,12 @@ export class Position {
this._x = x; this._x = x;
this._y = y; this._y = y;
} }
get x(): number {
return this._x;
}
get y(): number {
return this._y;
}
} }