const VELOCITY = [0.002, 0.0001]; const SHOOT_PROBABILITY = 0.0007; class Cloud extends Entity { static shootProbability = SHOOT_PROBABILITY; constructor(...args) { super(...args); this.element.className = 'cloud'; for (let i = 0; i < 10; i++) { const cloudParticle = document.createElement('div'); cloudParticle.className = 'cloud-particle'; cloudParticle.style.width = `${randRange(50, 80)}%`; cloudParticle.style.height = `${randRange(60, 100)}%`; cloudParticle.style.left = `${randRange(2, 98)}%`; cloudParticle.style.top = `${randRange(2, 98)}%`; cloudParticle.style.animationDelay = `${randRange(-10, 0)}s`; cloudParticle.style.animationDuration = `${randRange(0.5, 3)}s`; this.element.appendChild(cloudParticle); } } static reset() { this.shootProbability = SHOOT_PROBABILITY; } update(direction) { if (this.alive) { this.x += VELOCITY[0] * direction; this.y += VELOCITY[1]; if (Math.random() < Cloud.shootProbability) { const raindrop = new RainDrop(this.x, this.y + 0.009); bullets.add(raindrop); } } } destroy() { super.destroy(); Cloud.shootProbability += 0.0001; } }