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/Straight.ts | |
| parent | ef76266d1a61c02f1721efedc830fab12279d2b9 (diff) | |
| download | 1942-b4defa324a330217f0139f1240bcf53c0b1f996a.tar.gz 1942-b4defa324a330217f0139f1240bcf53c0b1f996a.tar.zst 1942-b4defa324a330217f0139f1240bcf53c0b1f996a.zip | |
v1.0.0
Diffstat (limited to 'src/enemies/Straight.ts')
| -rw-r--r-- | src/enemies/Straight.ts | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/enemies/Straight.ts b/src/enemies/Straight.ts index 7bc82f9..f57d6f3 100644 --- a/src/enemies/Straight.ts +++ b/src/enemies/Straight.ts @@ -9,11 +9,19 @@ export default class Straight extends Enemy { sprite = IMGS.simpleDown; width = IMGS.simpleDown.width; height = IMGS.simpleDown.height; - vel = 2 + vel = 2.5 phase = 0; spriteNum = 1; i = 0; - squares: Rectangle[] = [new Rectangle(this, 2, 2, this.width - 2, this.height - 2)] + squares: Rectangle[] = [new Rectangle(this, 2, 2, this.width - 4, this.height - 4)] + drop = false + + constructor(x: number, y: number, drop?: boolean) { + super(x, y) + if (drop) this.drop = drop + this.height = IMGS.simpleDown.height; + this._y = y - this.height + } move() { let dy = 0; @@ -35,7 +43,7 @@ export default class Straight extends Enemy { this.y += dy; this.width = this.sprite.width this.height = this.sprite.height - this.squares = [new Rectangle(this, 2, 2, this.width - 2, this.height - 2)] + this.squares = [new Rectangle(this, 2, 2, this.width - 4, this.height - 4)] return this.y + this.height < 0 } |
