diff options
| author | Maksymilian Jopek <maks@jopek.eu> | 2022-06-02 23:13:07 +0200 |
|---|---|---|
| committer | Maksymilian Jopek <maks@jopek.eu> | 2022-06-02 23:16:33 +0200 |
| commit | b4defa324a330217f0139f1240bcf53c0b1f996a (patch) | |
| tree | deabb94fd351b10d3d6b38d967424149536b3927 /src/enemies/BigCircle.ts | |
| parent | ef76266d1a61c02f1721efedc830fab12279d2b9 (diff) | |
| download | 1942-b4defa324a330217f0139f1240bcf53c0b1f996a.tar.gz 1942-b4defa324a330217f0139f1240bcf53c0b1f996a.tar.zst 1942-b4defa324a330217f0139f1240bcf53c0b1f996a.zip | |
v1.0.0
Diffstat (limited to 'src/enemies/BigCircle.ts')
| -rw-r--r-- | src/enemies/BigCircle.ts | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/enemies/BigCircle.ts b/src/enemies/BigCircle.ts index 1f9f7dd..b7666f5 100644 --- a/src/enemies/BigCircle.ts +++ b/src/enemies/BigCircle.ts @@ -11,8 +11,11 @@ export default class BigCircle extends Enemy { height = 40 sprite: HTMLImageElement | string = IMGS.bigCircleDown; strSprite = "bigCircleDown" + si = 0; + changeSprite = true; vel = 2 - health = 20 + health = 30 + points = 1100 phase = 0; @@ -229,6 +232,23 @@ export default class BigCircle extends Enemy { break; } + if (this.health < 30 - 20) { + if (this.si++ > 3) { this.changeSprite = !this.changeSprite; this.si = 0; } + } + else if (this.health < 30 - 10) { + if (this.si++ > 8) { this.changeSprite = !this.changeSprite; this.si = 0; } + } + else if (this.health < 30) { + if (this.si++ > 30) { this.changeSprite = !this.changeSprite; this.si = 0; } + } + if (this.changeSprite === true && this.health < 30) + //@ts-expect-error + this.sprite = IMGS[this.strSprite + "Red"] + else + //@ts-expect-error + this.sprite = IMGS[this.strSprite] + + this.x += xShift; this.y += yShift; return this.x2 < 0 || this.y2 < 0 || this.x > canvas.width || this.y > canvas.height |
