class PowerUpBall { constructor(game, cx, cy) { this.game = game; this.cx = cx; this.cy = cy; this.anim = 0.1; this.animChange = 0.025; } draw() { this.game.ctx.fillStyle = '#fff'; this.game.ctx.strokeStyle = '#fff'; this.game.ctx.beginPath(); this.game.ctx.arc(this.cx, this.cy, this.game.powerUpRadius * .6, 0, 2 * Math.PI); this.game.ctx.fill(); this.game.ctx.beginPath(); this.game.ctx.arc(this.cx, this.cy, this.game.powerUpRadius * (.6 + this.anim), 0, 2 * Math.PI); this.game.ctx.stroke(); this.anim = this.anim + this.animChange; if (this.anim >= .4 || this.anim <= 0.1) { this.animChange *= -1; } } hit() { sounds.hitBall.play(); this.game.newBalls++; this.remove(); } remove() { this.game.powerUps.splice(this.game.powerUps.findIndex(powerUp => powerUp === this), 1); } }