diff options
Diffstat (limited to 'src/enemies/Straight.ts')
| -rw-r--r-- | src/enemies/Straight.ts | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/enemies/Straight.ts b/src/enemies/Straight.ts index 895ec01..7bc82f9 100644 --- a/src/enemies/Straight.ts +++ b/src/enemies/Straight.ts @@ -1,6 +1,8 @@ import { canvas } from "../consts"; import { Rectangle } from "../Drawable"; -import { IMGS } from "../Images"; +import Bullet from "../drawables/Bullet"; +import { random } from "../helpers"; +import { getSmallDeathAnim, IMGS } from "../Images"; import Enemy from "./Enemy"; export default class Straight extends Enemy { @@ -36,4 +38,17 @@ export default class Straight extends Enemy { this.squares = [new Rectangle(this, 2, 2, this.width - 2, this.height - 2)] return this.y + this.height < 0 } + + hasShooted = false + shoot(bullets: Bullet[]): boolean { + if (this.hasShooted || this.phase !== 0) return false + if (random(0.008)) { + if (super.shoot(bullets)) + this.hasShooted = true + } + return true; + // (new Bullet(this.width / 2, this.y2, 0, 2, false)) + } + + deathAnim = getSmallDeathAnim(this) } |
