diff options
author | elioat <elioat@tilde.institute> | 2024-12-24 16:55:17 -0500 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2024-12-24 16:55:17 -0500 |
commit | eb9ccdab0a9151e8becd31f1aeb222ca237a2d8b (patch) | |
tree | f32a339f8c03b6555df9bf2226f8069576d90932 /html | |
parent | 73bbb413076d422135ee927f47f76d4e73fa8d30 (diff) | |
download | tour-eb9ccdab0a9151e8becd31f1aeb222ca237a2d8b.tar.gz |
*
Diffstat (limited to 'html')
-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++) { |