Spaces:
Running
Running
Update play.html
Browse files
play.html
CHANGED
|
@@ -14,7 +14,6 @@
|
|
| 14 |
.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; }
|
| 15 |
.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; }
|
| 16 |
|
| 17 |
-
/* BTN PIÙ GRANDE */
|
| 18 |
.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; }
|
| 19 |
.btn:hover { transform: scale(1.05); background: #fff; box-shadow: 0 0 40px rgba(0, 255, 65, 0.6); }
|
| 20 |
|
|
@@ -25,7 +24,7 @@
|
|
| 25 |
.floating-message {
|
| 26 |
position: absolute;
|
| 27 |
font-weight: 800;
|
| 28 |
-
font-size:
|
| 29 |
text-align: left;
|
| 30 |
pointer-events: none;
|
| 31 |
text-shadow: 2px 2px 0px #000;
|
|
@@ -148,7 +147,20 @@ const GAME_CONFIG = {
|
|
| 148 |
BAR_FULL: "🔥 MODALITÀ GENIO ATTIVA! 🔥"
|
| 149 |
},
|
| 150 |
|
| 151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
ENTITIES: {
|
| 153 |
LEGACY: {
|
| 154 |
CHAR: '☕',
|
|
@@ -365,7 +377,7 @@ const DOUBLE_JUMP = GAME_CONFIG.JUMP_FORCE * 0.9;
|
|
| 365 |
const GROUND_H = 80;
|
| 366 |
|
| 367 |
let state = { playing: false, speed: GAME_CONFIG.SPEED.INITIAL, score: 0, legacy: 0, flow: 50, frame: 0, phaseIdx: 0, shake: 0, combo: 0 };
|
| 368 |
-
let player = { x: 80, y: 0, w:
|
| 369 |
let entities = [], particles = [], bgStars = [];
|
| 370 |
|
| 371 |
const dom = {
|
|
@@ -386,9 +398,6 @@ const dom = {
|
|
| 386 |
};
|
| 387 |
|
| 388 |
function setupUI() {
|
| 389 |
-
// TITOLI RIMOSSI ANCHE DAL JS
|
| 390 |
-
// document.getElementById('title-main').innerText = GAME_CONFIG.TEXTS.TITLE;
|
| 391 |
-
// document.getElementById('subtitle-main').innerText = GAME_CONFIG.TEXTS.SUBTITLE;
|
| 392 |
document.getElementById('lbl-phase').innerText = GAME_CONFIG.TEXTS.LBL_PHASE;
|
| 393 |
document.getElementById('lbl-metrics').innerText = GAME_CONFIG.TEXTS.LBL_METRICS;
|
| 394 |
document.getElementById('lbl-score').innerText = GAME_CONFIG.TEXTS.LBL_SCORE;
|
|
@@ -397,7 +406,6 @@ function setupUI() {
|
|
| 397 |
document.getElementById('btn-restart').innerText = GAME_CONFIG.TEXTS.RESTART_BTN;
|
| 398 |
document.getElementById('controls-hint').innerText = GAME_CONFIG.TEXTS.CONTROLS;
|
| 399 |
|
| 400 |
-
// Use first element of array for description preview if needed, or just static text
|
| 401 |
document.getElementById('icon-legacy').innerText = GAME_CONFIG.ENTITIES.LEGACY.CHAR;
|
| 402 |
document.getElementById('title-legacy').innerText = GAME_CONFIG.ENTITIES.LEGACY.TITLE;
|
| 403 |
document.getElementById('desc-legacy').innerText = GAME_CONFIG.ENTITIES.LEGACY.DESC;
|
|
@@ -423,7 +431,7 @@ for(let i=0; i<80; i++) bgStars.push({ x: Math.random() * canvas.width, y: Math.
|
|
| 423 |
|
| 424 |
function initGame() {
|
| 425 |
Object.assign(state, { playing: true, speed: GAME_CONFIG.SPEED.INITIAL, score: 0, legacy: 0, flow: 50, frame: 0, phaseIdx: 0, shake: 0, combo: 0 });
|
| 426 |
-
Object.assign(player, { y: state.groundY - player.h, dy: 0, grounded: true, amplified: 0, stretch: 1 });
|
| 427 |
entities = []; particles = [];
|
| 428 |
|
| 429 |
dom.start.style.display = 'none';
|
|
@@ -453,7 +461,9 @@ function jump() {
|
|
| 453 |
player.stretch = 1.2;
|
| 454 |
state.flow = Math.max(0, state.flow - 25);
|
| 455 |
explosion(player.x + player.w/2, player.y + player.h, 15, '#00ff41');
|
| 456 |
-
|
|
|
|
|
|
|
| 457 |
}
|
| 458 |
updateHUD();
|
| 459 |
}
|
|
@@ -501,7 +511,10 @@ function loop() {
|
|
| 501 |
manageEntities(currentSpd);
|
| 502 |
drawParticles();
|
| 503 |
|
| 504 |
-
|
|
|
|
|
|
|
|
|
|
| 505 |
ctx.fillStyle = '#111'; ctx.fillRect(0, state.groundY, canvas.width, canvas.height - state.groundY);
|
| 506 |
ctx.strokeStyle = '#00ff41'; ctx.lineWidth = 4; ctx.beginPath();
|
| 507 |
ctx.moveTo(0, state.groundY); ctx.lineTo(canvas.width, state.groundY); ctx.stroke(); ctx.shadowBlur = 0;
|
|
@@ -532,7 +545,8 @@ function updatePlayer() {
|
|
| 532 |
let drawH = player.h * player.stretch, drawW = player.w * (1/player.stretch);
|
| 533 |
let drawX = player.x + (player.w - drawW)/2, drawY = player.y + (player.h - drawH);
|
| 534 |
|
| 535 |
-
|
|
|
|
| 536 |
|
| 537 |
if (state.frame % 3 === 0) particles.push({ x: drawX, y: drawY, w: drawW, h: drawH, life: 0.6, type: 'trail', color: ctx.fillStyle });
|
| 538 |
|
|
@@ -582,16 +596,15 @@ function rectHit(x1, y1, w1, h1, x2, y2, w2, h2) { return x2 < x1 + w1 && x2 + w
|
|
| 582 |
|
| 583 |
function handleHit(e) {
|
| 584 |
e.active = false;
|
| 585 |
-
|
| 586 |
-
// Pick RANDOM Message
|
| 587 |
let msgList = e.conf.MSG;
|
| 588 |
let randomMsg = Array.isArray(msgList) ? msgList[Math.floor(Math.random() * msgList.length)] : msgList;
|
| 589 |
|
| 590 |
if (e.type === 'OBSTACLE') {
|
| 591 |
if (player.amplified > 0) {
|
| 592 |
state.shake = 20;
|
| 593 |
-
|
| 594 |
-
|
|
|
|
| 595 |
state.score += 15; state.combo++;
|
| 596 |
showCombo();
|
| 597 |
} else {
|
|
@@ -599,7 +612,6 @@ function handleHit(e) {
|
|
| 599 |
}
|
| 600 |
} else {
|
| 601 |
explosion(e.x + e.w/2, e.y + e.h/2, 12, e.conf.COLOR);
|
| 602 |
-
// Colore del testo uguale all'entità raccolta
|
| 603 |
floatText(randomMsg, e.x + 80, e.y - 40, e.conf.COLOR);
|
| 604 |
|
| 605 |
if (e.type === 'LEGACY') {
|
|
@@ -637,17 +649,14 @@ function drawParticles() {
|
|
| 637 |
}
|
| 638 |
}
|
| 639 |
|
| 640 |
-
// Function modified to shift text right and use new CSS class
|
| 641 |
function floatText(txt, x, y, col) {
|
| 642 |
let el = document.createElement('div');
|
| 643 |
el.className = 'floating-message';
|
| 644 |
el.innerText = txt;
|
| 645 |
-
// Spostamento a destra di base (+100px) per evitare il bordo sinistro
|
| 646 |
el.style.left = (x + 60) + 'px';
|
| 647 |
el.style.top = y + 'px';
|
| 648 |
el.style.color = col;
|
| 649 |
document.body.appendChild(el);
|
| 650 |
-
// Timeout aumentato per matchare l'animazione CSS
|
| 651 |
setTimeout(() => el.remove(), 4000);
|
| 652 |
}
|
| 653 |
|
|
|
|
| 14 |
.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; }
|
| 15 |
.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; }
|
| 16 |
|
|
|
|
| 17 |
.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; }
|
| 18 |
.btn:hover { transform: scale(1.05); background: #fff; box-shadow: 0 0 40px rgba(0, 255, 65, 0.6); }
|
| 19 |
|
|
|
|
| 24 |
.floating-message {
|
| 25 |
position: absolute;
|
| 26 |
font-weight: 800;
|
| 27 |
+
font-size: 0.85rem;
|
| 28 |
text-align: left;
|
| 29 |
pointer-events: none;
|
| 30 |
text-shadow: 2px 2px 0px #000;
|
|
|
|
| 147 |
BAR_FULL: "🔥 MODALITÀ GENIO ATTIVA! 🔥"
|
| 148 |
},
|
| 149 |
|
| 150 |
+
JUMP_MESSAGES: [
|
| 151 |
+
"SALTO DI QUALITÀ!",
|
| 152 |
+
"SKIP MEETING!",
|
| 153 |
+
"BYPASS!",
|
| 154 |
+
"NEXT LEVEL!",
|
| 155 |
+
"ELEVATION!",
|
| 156 |
+
"QUOTA RAGGIUNTA!",
|
| 157 |
+
"CLOUD JUMP!",
|
| 158 |
+
"SORPASSO!",
|
| 159 |
+
"HOP!",
|
| 160 |
+
"AGILE JUMP!",
|
| 161 |
+
"SCALABILITÀ!"
|
| 162 |
+
],
|
| 163 |
+
|
| 164 |
ENTITIES: {
|
| 165 |
LEGACY: {
|
| 166 |
CHAR: '☕',
|
|
|
|
| 377 |
const GROUND_H = 80;
|
| 378 |
|
| 379 |
let state = { playing: false, speed: GAME_CONFIG.SPEED.INITIAL, score: 0, legacy: 0, flow: 50, frame: 0, phaseIdx: 0, shake: 0, combo: 0 };
|
| 380 |
+
let player = { x: 80, y: 0, w: 48, h: 48, dy: 0, grounded: false, canDouble: false, amplified: 0, stretch: 1 };
|
| 381 |
let entities = [], particles = [], bgStars = [];
|
| 382 |
|
| 383 |
const dom = {
|
|
|
|
| 398 |
};
|
| 399 |
|
| 400 |
function setupUI() {
|
|
|
|
|
|
|
|
|
|
| 401 |
document.getElementById('lbl-phase').innerText = GAME_CONFIG.TEXTS.LBL_PHASE;
|
| 402 |
document.getElementById('lbl-metrics').innerText = GAME_CONFIG.TEXTS.LBL_METRICS;
|
| 403 |
document.getElementById('lbl-score').innerText = GAME_CONFIG.TEXTS.LBL_SCORE;
|
|
|
|
| 406 |
document.getElementById('btn-restart').innerText = GAME_CONFIG.TEXTS.RESTART_BTN;
|
| 407 |
document.getElementById('controls-hint').innerText = GAME_CONFIG.TEXTS.CONTROLS;
|
| 408 |
|
|
|
|
| 409 |
document.getElementById('icon-legacy').innerText = GAME_CONFIG.ENTITIES.LEGACY.CHAR;
|
| 410 |
document.getElementById('title-legacy').innerText = GAME_CONFIG.ENTITIES.LEGACY.TITLE;
|
| 411 |
document.getElementById('desc-legacy').innerText = GAME_CONFIG.ENTITIES.LEGACY.DESC;
|
|
|
|
| 431 |
|
| 432 |
function initGame() {
|
| 433 |
Object.assign(state, { playing: true, speed: GAME_CONFIG.SPEED.INITIAL, score: 0, legacy: 0, flow: 50, frame: 0, phaseIdx: 0, shake: 0, combo: 0 });
|
| 434 |
+
Object.assign(player, { y: state.groundY - player.h, dy: 0, grounded: true, amplified: 0, stretch: 1, w: 48, h: 48 });
|
| 435 |
entities = []; particles = [];
|
| 436 |
|
| 437 |
dom.start.style.display = 'none';
|
|
|
|
| 461 |
player.stretch = 1.2;
|
| 462 |
state.flow = Math.max(0, state.flow - 25);
|
| 463 |
explosion(player.x + player.w/2, player.y + player.h, 15, '#00ff41');
|
| 464 |
+
|
| 465 |
+
let msg = GAME_CONFIG.JUMP_MESSAGES[Math.floor(Math.random() * GAME_CONFIG.JUMP_MESSAGES.length)];
|
| 466 |
+
floatText(msg, player.x + 40, player.y - 40, '#00ff41');
|
| 467 |
}
|
| 468 |
updateHUD();
|
| 469 |
}
|
|
|
|
| 511 |
manageEntities(currentSpd);
|
| 512 |
drawParticles();
|
| 513 |
|
| 514 |
+
// SHADOW LOGIC: White if amplified, else dark gray
|
| 515 |
+
ctx.shadowBlur = 10;
|
| 516 |
+
ctx.shadowColor = player.amplified > 0 ? '#ffffff' : '#444';
|
| 517 |
+
|
| 518 |
ctx.fillStyle = '#111'; ctx.fillRect(0, state.groundY, canvas.width, canvas.height - state.groundY);
|
| 519 |
ctx.strokeStyle = '#00ff41'; ctx.lineWidth = 4; ctx.beginPath();
|
| 520 |
ctx.moveTo(0, state.groundY); ctx.lineTo(canvas.width, state.groundY); ctx.stroke(); ctx.shadowBlur = 0;
|
|
|
|
| 545 |
let drawH = player.h * player.stretch, drawW = player.w * (1/player.stretch);
|
| 546 |
let drawX = player.x + (player.w - drawW)/2, drawY = player.y + (player.h - drawH);
|
| 547 |
|
| 548 |
+
// PLAYER COLOR LOGIC: White if amplified, else Neon Green
|
| 549 |
+
ctx.fillStyle = player.amplified > 0 ? '#ffffff' : '#00ff41';
|
| 550 |
|
| 551 |
if (state.frame % 3 === 0) particles.push({ x: drawX, y: drawY, w: drawW, h: drawH, life: 0.6, type: 'trail', color: ctx.fillStyle });
|
| 552 |
|
|
|
|
| 596 |
|
| 597 |
function handleHit(e) {
|
| 598 |
e.active = false;
|
|
|
|
|
|
|
| 599 |
let msgList = e.conf.MSG;
|
| 600 |
let randomMsg = Array.isArray(msgList) ? msgList[Math.floor(Math.random() * msgList.length)] : msgList;
|
| 601 |
|
| 602 |
if (e.type === 'OBSTACLE') {
|
| 603 |
if (player.amplified > 0) {
|
| 604 |
state.shake = 20;
|
| 605 |
+
// White explosion for destruction in God Mode
|
| 606 |
+
explosion(e.x + e.w/2, e.y + e.h/2, 25, '#ffffff');
|
| 607 |
+
floatText(randomMsg, e.x + 80, e.y - 20, '#fff');
|
| 608 |
state.score += 15; state.combo++;
|
| 609 |
showCombo();
|
| 610 |
} else {
|
|
|
|
| 612 |
}
|
| 613 |
} else {
|
| 614 |
explosion(e.x + e.w/2, e.y + e.h/2, 12, e.conf.COLOR);
|
|
|
|
| 615 |
floatText(randomMsg, e.x + 80, e.y - 40, e.conf.COLOR);
|
| 616 |
|
| 617 |
if (e.type === 'LEGACY') {
|
|
|
|
| 649 |
}
|
| 650 |
}
|
| 651 |
|
|
|
|
| 652 |
function floatText(txt, x, y, col) {
|
| 653 |
let el = document.createElement('div');
|
| 654 |
el.className = 'floating-message';
|
| 655 |
el.innerText = txt;
|
|
|
|
| 656 |
el.style.left = (x + 60) + 'px';
|
| 657 |
el.style.top = y + 'px';
|
| 658 |
el.style.color = col;
|
| 659 |
document.body.appendChild(el);
|
|
|
|
| 660 |
setTimeout(() => el.remove(), 4000);
|
| 661 |
}
|
| 662 |
|