aboutsummaryrefslogtreecommitdiffstats
path: root/src/enemies/Enemy.ts
diff options
context:
space:
mode:
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
}
}