fix: subtle torch/campfire flicker, stable warm glow overlay
This commit is contained in:
parent
d948b1743d
commit
a5f9ac841f
12
game.js
12
game.js
|
|
@ -3862,7 +3862,7 @@ registerProcessor('voice-playback', VoicePlaybackProcessor);
|
|||
function drawFire(wx,wy,now){
|
||||
const baseX = wx;
|
||||
const baseY = wy;
|
||||
const flick = 6 + (Math.sin(now/90)+1)*4;
|
||||
const flick = 1.5 + (Math.sin(now/200)+1)*1;
|
||||
ctx.fillStyle = 'rgba(255,140,0,0.85)';
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(baseX+10, baseY+30);
|
||||
|
|
@ -4962,7 +4962,7 @@ registerProcessor('voice-playback', VoicePlaybackProcessor);
|
|||
|
||||
// Функция: рисуем мягкий луч света с затуханием за стенами
|
||||
function castLight(sx, sy, radius) {
|
||||
const flick = 0.92 + Math.sin(now/80 + sx*0.01)*0.04 + Math.sin(now/130 + sy*0.02)*0.04;
|
||||
const flick = 0.97 + Math.sin(now/300 + sx*0.01)*0.015 + Math.sin(now/470 + sy*0.02)*0.015;
|
||||
const r = radius * flick;
|
||||
// 24 луча — мягкий круглый свет
|
||||
const steps = 24;
|
||||
|
|
@ -5032,13 +5032,13 @@ registerProcessor('voice-playback', VoicePlaybackProcessor);
|
|||
if(b.gx < minGX-3 || b.gx > maxGX+3 || b.gy < minGY-3 || b.gy > maxGY+3) continue;
|
||||
const def = BLOCKS[b.t];
|
||||
if(def.lightRadius){
|
||||
const flick = 0.7 + Math.sin(now/90 + b.gx*3.7)*0.15 + Math.sin(now/140 + b.gy*2.3)*0.15;
|
||||
const flick = 0.9 + Math.sin(now/350 + b.gx*3.7)*0.05 + Math.sin(now/530 + b.gy*2.3)*0.05;
|
||||
const wx = b.gx*TILE + TILE/2 - camX;
|
||||
const wy = b.gy*TILE + TILE/2 - camY;
|
||||
const r = def.lightRadius * 0.75 * flick;
|
||||
const r = def.lightRadius * 0.85;
|
||||
const grad = ctx.createRadialGradient(wx,wy, 0, wx,wy, r);
|
||||
grad.addColorStop(0, `rgba(255,180,80,${0.22*flick})`);
|
||||
grad.addColorStop(0.5, `rgba(255,140,40,${0.10*flick})`);
|
||||
grad.addColorStop(0, `rgba(255,180,80,0.28)`);
|
||||
grad.addColorStop(0.5, `rgba(255,140,40,0.13)`);
|
||||
grad.addColorStop(1, 'rgba(255,100,20,0)');
|
||||
ctx.fillStyle = grad;
|
||||
ctx.beginPath();
|
||||
|
|
|
|||
|
|
@ -94,6 +94,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<script src="game.js?v=26"></script>
|
||||
<script src="game.js?v=27"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in New Issue