aboutsummaryrefslogtreecommitdiffstats
path: root/src/enemies/Enemy.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/enemies/Enemy.ts
parent7a494b148dd03d6346a63641fc479015e7450a26 (diff)
download1942-6c37585ef4ef2535aff8c45c64850be0a6c26eab.tar.gz
1942-6c37585ef4ef2535aff8c45c64850be0a6c26eab.tar.zst
1942-6c37585ef4ef2535aff8c45c64850be0a6c26eab.zip
Death animations
Diffstat (limited to 'src/enemies/Enemy.ts')
-rw-r--r--src/enemies/Enemy.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/enemies/Enemy.ts b/src/enemies/Enemy.ts
index d85b11e..224e66c 100644
--- a/src/enemies/Enemy.ts
+++ b/src/enemies/Enemy.ts
@@ -1,14 +1,17 @@
import Bullet from "../drawables/Bullet";
-import { BULLET_VEL } from "../consts";
+import { BULLET_VEL, TOPBAR_HEIGHT } from "../consts";
import Drawable, { Rectangle } from "../Drawable";
+import Anime from "../Animation";
export default abstract class Enemy extends Drawable {
squares: Array<Rectangle> = [new Rectangle(this)]
points = 5;
health = 2
- deathAnim: (string | HTMLImageElement)[] = ["red"]
+ deathAnim!: Anime;
- shoot(bullet: Bullet[]) {
+ shoot(bullet: Bullet[]): boolean {
+ if (this.y2 < TOPBAR_HEIGHT) return false
bullet.push(new Bullet(this.x + (this.width / 2) - Bullet.width / 2, this.y2, 0, BULLET_VEL, false))
+ return true
}
}