aboutsummaryrefslogtreecommitdiffstats
path: root/src/Drawable.ts
diff options
context:
space:
mode:
authorMaksymilian Jopek <maks@jopek.eu>2022-06-02 08:54:02 +0200
committerMaksymilian Jopek <maks@jopek.eu>2022-06-02 08:54:02 +0200
commit6c37585ef4ef2535aff8c45c64850be0a6c26eab (patch)
treec53e07505182735fbd23687a0c731d4bb2f10e14 /src/Drawable.ts
parent7a494b148dd03d6346a63641fc479015e7450a26 (diff)
download1942-6c37585ef4ef2535aff8c45c64850be0a6c26eab.tar.gz
1942-6c37585ef4ef2535aff8c45c64850be0a6c26eab.tar.zst
1942-6c37585ef4ef2535aff8c45c64850be0a6c26eab.zip
Death animations
Diffstat (limited to 'src/Drawable.ts')
-rw-r--r--src/Drawable.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Drawable.ts b/src/Drawable.ts
index 9ed9a2a..375d515 100644
--- a/src/Drawable.ts
+++ b/src/Drawable.ts
@@ -73,7 +73,7 @@ export default abstract class Drawable {
if (val <= 15 + 24) this._y = 15 + 24;
// else if (val + this.height >= canvas.height - 15) this._y = canvas.height - 15 - this.height + diff;
else if (val + this.height >= canvas.height - 15) {
- if (left || right) return
+ if (left || right) this._y = canvas.height - 15 - this.height + diff + 1;
else this._y = canvas.height - 15 - this.height + diff;
}
else this._y = val
@@ -90,6 +90,7 @@ export default abstract class Drawable {
}
export class Rectangle extends Drawable {
+ sprite = "rgba(128,0,128, 0.5)"
constructor(public begetter: Drawable, x?: number, y?: number, width?: number, height?: number) {
if (begetter.width === PLAYER_SIZE) {
console.log(begetter.x, begetter.y, begetter.width, begetter.height);
@@ -111,7 +112,6 @@ export class Rectangle extends Drawable {
set y(val) { this._y = val }
get x2() { return this.x + this.width }
get y2() { return this.y + this.height }
- sprite = "rgba(128,0,128, 0.5)"
}
// export abstract class Square {
// constructor(public x: number, public y: number, public width: number, public height: number) { }