Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lesson 28-29. Hive Whale and Drone enemy class
- Loading branch information
Зелёный Андрей Сергеевич
committed
Jan 8, 2024
1 parent
270dd10
commit 1a8eae7
Showing
3 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class Drone extends Enemy { | ||
constructor(game, x, y) { | ||
super(game); | ||
this.width = 115; | ||
this.height = 95; | ||
this.x = x; | ||
this.y = y; | ||
this.image = document.getElementById('drone'); | ||
this.frameY = Math.floor(Math.random() * 2); | ||
this.lives = 3; | ||
this.score = this.lives; | ||
this.type = 'drone'; | ||
this.speedX = Math.random() * -4.2 - 0.5; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class HiveWhale extends Enemy { | ||
constructor(game) { | ||
super(game); | ||
this.width = 400; | ||
this.height = 227; | ||
this.y = Math.random() * (this.game.height * 0.95 - this.height); | ||
this.image = document.getElementById('hivewhale'); | ||
this.frameY = 0; | ||
this.lives = 20; | ||
this.score = this.lives; | ||
this.type = 'hive'; | ||
this.speedX = Math.random() * -1.2 - 0.2; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters