Game for OLC Code Jam 2022
Ви не можете вибрати більше 25 тем Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. class Bullet extends Entity {
  2. constructor(x, y) {
  3. super(x, y, 0.001, 0.02);
  4. this.element.className = 'bullet';
  5. }
  6. update() {
  7. if (this.alive) {
  8. this.y -= 0.01;
  9. if (this.y < -0.1) {
  10. this.destroy();
  11. }
  12. for (let cloud of clouds) {
  13. if (this.isOverlapped(cloud)) {
  14. cloud.destroy();
  15. this.destroy();
  16. }
  17. }
  18. }
  19. }
  20. }
  21. class RainDrop extends Bullet {
  22. constructor(x, y) {
  23. super(x, y);
  24. this.element.className = 'raindrop';
  25. }
  26. update() {
  27. if (this.alive) {
  28. this.y += 0.01;
  29. if (this.y > 1.1) {
  30. this.destroy();
  31. } else if (this.isOverlapped(shootingPad)) {
  32. shootingPad.lifeOver();
  33. this.destroy();
  34. }
  35. }
  36. }
  37. }