diff options
| author | Maksymilian Jopek <maks@jopek.eu> | 2022-06-01 18:53:40 +0200 |
|---|---|---|
| committer | Maksymilian Jopek <maks@jopek.eu> | 2022-06-01 18:53:40 +0200 |
| commit | 7a494b148dd03d6346a63641fc479015e7450a26 (patch) | |
| tree | 08cffc645937617a8d39f456fa4bad04dd80af74 /src/drawables/TopBar.ts | |
| parent | 5413001f654d4ea27129cf2edfc15322f2ba27ec (diff) | |
| download | 1942-7a494b148dd03d6346a63641fc479015e7450a26.tar.gz 1942-7a494b148dd03d6346a63641fc479015e7450a26.tar.zst 1942-7a494b148dd03d6346a63641fc479015e7450a26.zip | |
Startscreen adn sfx
Diffstat (limited to 'src/drawables/TopBar.ts')
| -rw-r--r-- | src/drawables/TopBar.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/drawables/TopBar.ts b/src/drawables/TopBar.ts index 8772050..d92db07 100644 --- a/src/drawables/TopBar.ts +++ b/src/drawables/TopBar.ts @@ -13,11 +13,14 @@ export class TopBar extends Drawable { constructor() { super(0, 0) } - setData(score: number, lives: number, rolls: number, highscore?: number) { + setData(score: number, lives: number, rolls: number, highscore?: number | string) { this.score = score this.lives = lives this.rolls = rolls - this.highscore = highscore ?? this.highscore + if (highscore) { + if (typeof highscore === "string") highscore = parseInt(highscore) + this.highscore = highscore + } } draw() { if (this.sprite.src == null) this.sprite = IMGS.topbar; |
