1234567891011121314151617181920212223242526272829303132333435363738394041 |
- class Bullet extends Entity {
- constructor(x, y) {
- super(x, y, 0.001, 0.02);
- this.element.className = 'bullet';
- }
-
- update() {
- if (this.alive) {
- this.y -= 0.01;
- if (this.y < -0.1) {
- this.destroy();
- }
-
- for (let cloud of clouds) {
- if (this.isOverlapped(cloud)) {
- cloud.destroy();
- this.destroy();
- }
- }
- }
- }
- }
-
- class RainDrop extends Bullet {
- constructor(x, y) {
- super(x, y);
- this.element.className = 'raindrop';
- }
-
- update() {
- if (this.alive) {
- this.y += 0.01;
- if (this.y > 1.1) {
- this.destroy();
- } else if (this.isOverlapped(shootingPad)) {
- shootingPad.lifeOver();
- this.destroy();
- }
- }
- }
- }
|