diff options
Diffstat (limited to 'html/tower/js/renderer.js')
-rw-r--r-- | html/tower/js/renderer.js | 60 |
1 files changed, 50 insertions, 10 deletions
diff --git a/html/tower/js/renderer.js b/html/tower/js/renderer.js index 24a18ef..ddae51d 100644 --- a/html/tower/js/renderer.js +++ b/html/tower/js/renderer.js @@ -147,16 +147,56 @@ function renderParticles(ctx, particles) { if (lifePercent <= 1) { ctx.globalAlpha = 1 - lifePercent; - ctx.fillStyle = particle.color; - ctx.beginPath(); - ctx.arc( - particle.position.x, - particle.position.y, - particle.size * (1 - lifePercent), - 0, - Math.PI * 2 - ); - ctx.fill(); + + if (particle.type === 'AOE_EXPLOSION') { + // Draw expanding circle + const radius = particle.initialRadius + + (particle.finalRadius - particle.initialRadius) * lifePercent; + + // Draw multiple rings for better effect + const numRings = 3; + for (let i = 0; i < numRings; i++) { + const ringRadius = radius * (1 - (i * 0.2)); + const ringAlpha = (1 - lifePercent) * (1 - (i * 0.3)); + + ctx.beginPath(); + ctx.arc( + particle.position.x, + particle.position.y, + ringRadius, + 0, + Math.PI * 2 + ); + ctx.strokeStyle = particle.color; + ctx.lineWidth = particle.ringWidth * (1 - (i * 0.2)); + ctx.globalAlpha = ringAlpha; + ctx.stroke(); + } + + // Draw affected area + ctx.beginPath(); + ctx.arc( + particle.position.x, + particle.position.y, + radius, + 0, + Math.PI * 2 + ); + ctx.fillStyle = particle.color + '20'; // Very transparent fill + ctx.fill(); + } else { + // Original particle rendering + ctx.fillStyle = particle.color; + ctx.beginPath(); + ctx.arc( + particle.position.x, + particle.position.y, + particle.size * (1 - lifePercent), + 0, + Math.PI * 2 + ); + ctx.fill(); + } } }); ctx.globalAlpha = 1; |