diff options
Diffstat (limited to 'html/rogue')
-rw-r--r-- | html/rogue/js/world.js | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/html/rogue/js/world.js b/html/rogue/js/world.js index 6213f42..fb29e27 100644 --- a/html/rogue/js/world.js +++ b/html/rogue/js/world.js @@ -598,27 +598,35 @@ const renderFirTree = (ctx, tree, groundY) => { // Draw center column of needles first const centerX = x; - // Draw a needle pointing left - ctx.strokeStyle = greenColors[Math.floor(seededRandom(centerX - 1, rowY) * greenColors.length)]; - ctx.beginPath(); - ctx.moveTo(centerX, rowY); - const leftAngle = Math.PI + (Math.PI * 0.05 * seededRandom(centerX, rowY) - Math.PI * 0.025); - ctx.lineTo( - centerX + Math.cos(leftAngle) * featherLength * taper, - rowY + Math.sin(leftAngle) * featherLength * taper - ); - ctx.stroke(); + const needleCount = 5; // Number of additional needles on each side + const needleSpacing = 1.5; // Spacing between additional needles - // Draw a needle pointing right - ctx.strokeStyle = greenColors[Math.floor(seededRandom(centerX + 1, rowY) * greenColors.length)]; - ctx.beginPath(); - ctx.moveTo(centerX, rowY); - const rightAngle = 0 + (Math.PI * 0.05 * seededRandom(centerX, rowY) - Math.PI * 0.025); - ctx.lineTo( - centerX + Math.cos(rightAngle) * featherLength * taper, - rowY + Math.sin(rightAngle) * featherLength * taper - ); - ctx.stroke(); + for (let i = -needleCount; i <= needleCount; i++) { + // Calculate offset for each needle + const offset = i * (needleSpacing * 1.5); + + // Draw a needle pointing left + ctx.strokeStyle = greenColors[Math.floor(seededRandom(centerX + offset - 1, rowY) * greenColors.length)]; + ctx.beginPath(); + ctx.moveTo(centerX + offset - 1, rowY); // Start slightly left of center + const leftAngle = Math.PI + (Math.PI * 0.02 * seededRandom(centerX + offset, rowY) - Math.PI * 0.01); + ctx.lineTo( + centerX + offset + Math.cos(leftAngle) * featherLength * taper, + rowY + Math.sin(leftAngle) * featherLength * taper + ); + ctx.stroke(); + + // Draw a needle pointing right + ctx.strokeStyle = greenColors[Math.floor(seededRandom(centerX + offset + 1, rowY) * greenColors.length)]; + ctx.beginPath(); + ctx.moveTo(centerX + offset + 1, rowY); // Start slightly right of center + const rightAngle = 0 + (Math.PI * 0.02 * seededRandom(centerX + offset, rowY) - Math.PI * 0.01); + ctx.lineTo( + centerX + offset + Math.cos(rightAngle) * featherLength * taper, + rowY + Math.sin(rightAngle) * featherLength * taper + ); + ctx.stroke(); + } // Draw regular feathers for this row for (let i = 0; i < featherCount; i++) { |