Total Destruction Mod - Menu [top]
// draw shockwave and additional canvas effects function drawCanvasEffects() if(!ctx) return; ctx.clearRect(0,0, canvas.width, canvas.height); if(shockwaveActive && shockwaveRadius > 0) ctx.beginPath(); ctx.arc(shockwaveX, shockwaveY, shockwaveRadius, 0, Math.PI*2); ctx.strokeStyle = `rgba(255, 100, 20, $1 - shockwaveRadius/180)`; ctx.lineWidth = 8; ctx.stroke(); ctx.beginPath(); ctx.arc(shockwaveX, shockwaveY, shockwaveRadius*0.6, 0, Math.PI*2); ctx.fillStyle = `rgba(255, 50, 0, $0.3 - shockwaveRadius/250)`; ctx.fill();
// spawn random destructible objects (victims) function spawnDestructibleItem(customX = null, customY = null) const zoneRect = zone.getBoundingClientRect(); if(zoneRect.width === 0) return null; const itemDiv = document.createElement('div'); itemDiv.className = 'destructible'; // random type: different visual style for fun const typeRand = Math.floor(Math.random() * 5); let icon = '💀'; let bgColor = '#aa2e1e'; if(typeRand === 0) icon = '💢'; if(typeRand === 1) icon = '⚡'; if(typeRand === 2) icon = '🧨'; if(typeRand === 3) icon = '🔥'; if(typeRand === 4) icon = '💣'; const size = 42 + Math.random() * 28; itemDiv.innerHTML = `<div style="font-size: $sizepx; text-align:center; filter:drop-shadow(0 0 4px orange);">$icon</div>`; itemDiv.style.width = 'auto'; itemDiv.style.height = 'auto'; itemDiv.style.left = (customX !== null ? customX : Math.random() * (zoneRect.width - 70) + 15) + 'px'; itemDiv.style.top = (customY !== null ? customY : Math.random() * (zoneRect.height - 70) + 15) + 'px'; itemDiv.style.position = 'absolute'; itemDiv.setAttribute('data-id', nextId++); itemDiv.setAttribute('data-hp', 1); // store destruction value: adds multiplier effect zone.appendChild(itemDiv); // add click destruction event itemDiv.addEventListener('click', (e) => e.stopPropagation(); destroySingleItem(itemDiv, false); ); destructionItems.push(itemDiv); return itemDiv; total destruction mod menu