Spaces:
Running
Running
Update play.html
Browse files13 unmodified lines141516171718194 unmodified lines2425262827282930116 unmodified lines147148149151150151152153154155156157158159160161162163164165166210 unmodified lines37737837936838038138238314 unmodified lines3983994003893903914014024032 unmodified lines40640740840040941041119 unmodified lines43143243342643443543643723 unmodified lines46146246345646446546646746846941 unmodified lines51151251350451451551651751851952024 unmodified lines54554654754853554955055155243 unmodified lines5965975985855865996006016026036046055935946066076086096101 unmodified line61261361460261561661731 unmodified lines64965065164065265365465564565665765865965066066166213 unmodified lines .scanlines { background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.1)); background-size: 100% 4px; position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; z-index: 10; } .ui-panel { backdrop-filter: blur(5px); background: rgba(20, 20, 20, 0.8); border: 1px solid rgba(255, 255, 255, 0.1); transition: all 0.2s; } /* BTN PIÙ GRANDE */ .btn { background: var(--neon-green); color: #000; padding: 20px 50px; font-size: 1.5rem; font-weight: 800; text-transform: uppercase; cursor: pointer; border-radius: 4px; box-shadow: 0 0 20px rgba(0, 255, 65, 0.4); transition: 0.2s; border: none; } .btn:hover { transform: scale(1.05); background: #fff; box-shadow: 0 0 40px rgba(0, 255, 65, 0.6); } 4 unmodified lines .floating-message { position: absolute; font-weight: 800; font-size: 1.2rem; font-size: 0.85rem; text-align: left; pointer-events: none; text-shadow: 2px 2px 0px #000; 116 unmodified lines BAR_FULL: "🔥 MODALITÀ GENIO ATTIVA! 🔥" },
// ORA CON LISTE DI MESSAGGI RANDOM! JUMP_MESSAGES: [ "SALTO DI QUALITÀ!", "SKIP MEETING!", "BYPASS!", "NEXT LEVEL!", "ELEVATION!", "QUOTA RAGGIUNTA!", "CLOUD JUMP!", "SORPASSO!", "HOP!", "AGILE JUMP!", "SCALABILITÀ!" ],
ENTITIES: { LEGACY: { CHAR: '☕', 210 unmodified linesconst GROUND_H = 80;
let state = { playing: false, speed: GAME_CONFIG.SPEED.INITIAL, score: 0, legacy: 0, flow: 50, frame: 0, phaseIdx: 0, shake: 0, combo: 0 };let player = { x: 80, y: 0, w: 35, h: 35, dy: 0, grounded: false, canDouble: false, amplified: 0, stretch: 1 };let player = { x: 80, y: 0, w: 48, h: 48, dy: 0, grounded: false, canDouble: false, amplified: 0, stretch: 1 };let entities = [], particles = [], bgStars = [];
const dom = {14 unmodified lines};
function setupUI() { // TITOLI RIMOSSI ANCHE DAL JS // document.getElementById('title-main').innerText = GAME_CONFIG.TEXTS.TITLE; // document.getElementById('subtitle-main').innerText = GAME_CONFIG.TEXTS.SUBTITLE; document.getElementById('lbl-phase').innerText = GAME_CONFIG.TEXTS.LBL_PHASE; document.getElementById('lbl-metrics').innerText = GAME_CONFIG.TEXTS.LBL_METRICS; document.getElementById('lbl-score').innerText = GAME_CONFIG.TEXTS.LBL_SCORE;2 unmodified lines document.getElementById('btn-restart').innerText = GAME_CONFIG.TEXTS.RESTART_BTN; document.getElementById('controls-hint').innerText = GAME_CONFIG.TEXTS.CONTROLS;
// Use first element of array for description preview if needed, or just static text document.getElementById('icon-legacy').innerText = GAME_CONFIG.ENTITIES.LEGACY.CHAR; document.getElementById('title-legacy').innerText = GAME_CONFIG.ENTITIES.LEGACY.TITLE; document.getElementById('desc-legacy').innerText = GAME_CONFIG.ENTITIES.LEGACY.DESC;19 unmodified lines
function initGame() { Object.assign(state, { playing: true, speed: GAME_CONFIG.SPEED.INITIAL, score: 0, legacy: 0, flow: 50, frame: 0, phaseIdx: 0, shake: 0, combo: 0 }); Object.assign(player, { y: state.groundY - player.h, dy: 0, grounded: true, amplified: 0, stretch: 1 }); Object.assign(player, { y: state.groundY - player.h, dy: 0, grounded: true, amplified: 0, stretch: 1, w: 48, h: 48 }); entities = []; particles = []; dom.start.style.display = 'none';23 unmodified lines player.stretch = 1.2; state.flow = Math.max(0, state.flow - 25); explosion(player.x + player.w/2, player.y + player.h, 15, '#00ff41'); floatText("ELEVAZIONE", player.x + 40, player.y - 40, '#00ff41'); // Offset right let msg = GAME_CONFIG.JUMP_MESSAGES[Math.floor(Math.random() * GAME_CONFIG.JUMP_MESSAGES.length)]; floatText(msg, player.x + 40, player.y - 40, '#00ff41'); } updateHUD();}41 unmodified lines manageEntities(currentSpd); drawParticles();
ctx.shadowBlur = 10; ctx.shadowColor = player.amplified > 0 ? '#00ff41' : '#444'; // SHADOW LOGIC: White if amplified, else dark gray ctx.shadowBlur = 10; ctx.shadowColor = player.amplified > 0 ? '#ffffff' : '#444'; ctx.fillStyle = '#111'; ctx.fillRect(0, state.groundY, canvas.width, canvas.height - state.groundY); ctx.strokeStyle = '#00ff41'; ctx.lineWidth = 4; ctx.beginPath(); ctx.moveTo(0, state.groundY); ctx.lineTo(canvas.width, state.groundY); ctx.stroke(); ctx.shadowBlur = 0;24 unmodified lines let drawH = player.h * player.stretch, drawW = player.w * (1/player.stretch); let drawX = player.x + (player.w - drawW)/2, drawY = player.y + (player.h - drawH); // PLAYER COLOR LOGIC: White if amplified, else Neon Green ctx.fillStyle = player.amplified > 0 ? ((state.frame % 4 < 2) ? '#fff' : '#00ff41') : '#00ff41'; ctx.fillStyle = player.amplified > 0 ? '#ffffff' : '#00ff41'; if (state.frame % 3 === 0) particles.push({ x: drawX, y: drawY, w: drawW, h: drawH, life: 0.6, type: 'trail', color: ctx.fillStyle }); 43 unmodified lines
function handleHit(e) { e.active = false; // Pick RANDOM Message let msgList = e.conf.MSG; let randomMsg = Array.isArray(msgList) ? msgList[Math.floor(Math.random() * msgList.length)] : msgList;
if (e.type === 'OBSTACLE') { if (player.amplified > 0) { state.shake = 20; // White explosion for destruction in God Mode explosion(e.x + e.w/2, e.y + e.h/2, 25, '#ff0055'); floatText(randomMsg, e.x + 80, e.y - 20, '#fff'); // White text for destruction explosion(e.x + e.w/2, e.y + e.h/2, 25, '#ffffff'); floatText(randomMsg, e.x + 80, e.y - 20, '#fff'); state.score += 15; state.combo++; showCombo(); } else {1 unmodified line } } else { explosion(e.x + e.w/2, e.y + e.h/2, 12, e.conf.COLOR); // Colore del testo uguale all'entità raccolta floatText(randomMsg, e.x + 80, e.y - 40, e.conf.COLOR); if (e.type === 'LEGACY') { 31 unmodified lines }}
// Function modified to shift text right and use new CSS classfunction floatText(txt, x, y, col) { let el = document.createElement('div'); el.className = 'floating-message'; el.innerText = txt; // Spostamento a destra di base (+100px) per evitare il bordo sinistro el.style.left = (x + 60) + 'px'; el.style.top = y + 'px'; el.style.color = col; document.body.appendChild(el); // Timeout aumentato per matchare l'animazione CSS setTimeout(() => el.remove(), 4000);}
play.html+29-20