{"id":25,"date":"2026-09-10T16:10:48","date_gmt":"2026-09-10T14:10:48","guid":{"rendered":"https:\/\/astro.newgenesys.eu\/?page_id=25"},"modified":"2026-09-10T16:10:48","modified_gmt":"2026-09-10T14:10:48","slug":"cosmic-escape","status":"publish","type":"page","link":"https:\/\/astro.newgenesys.eu\/index.php\/cosmic-escape\/","title":{"rendered":"Cosmic Escape"},"content":{"rendered":"\r\n\r\n<!DOCTYPE html>\r\n<html lang=\"it\">\r\n<head>\r\n    <meta charset=\"UTF-8\">\r\n    <title>Zodiac Racer - Il tuo Tema Natale<\/title>\r\n\r\n\t\r\n<style>\r\n@font-face {\r\n    font-family: 'ZodiacFont';\r\n    src: url('https:\/\/astro.newgenesys.eu\/wp-content\/plugins\/pop-astrology\/templates\/hamburgsymbols-webfont.ttf') format('truetype');\r\n    font-weight: normal;\r\n    font-style: normal;\r\n}\r\n\r\n\/* --- LAYOUT GENERALE E CONTENITORE --- *\/\r\n#zodiac-game-dark-theme {\r\n    background-color: #0a0a0a;\r\n    color: #ffffff;\r\n    padding: 25px 20px; \r\n    border-radius: 20px;\r\n    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\r\n    margin: 20px auto;\r\n    max-width: 1000px;\r\n    box-shadow: 0 0 40px rgba(0,0,0,0.8);\r\n    box-sizing: border-box;\r\n    overflow: hidden;\r\n}\r\n\r\n#zodiac-game-dark-theme h1 {\r\n    color: #d4af37 !important;\r\n    text-align: center;\r\n    text-transform: uppercase;\r\n    letter-spacing: 2px;\r\n    margin-bottom: 20px;\r\n}\r\n\r\n#zodiac-game-dark-theme h1:nth-of-type(n+2),\r\n.page-template-default .entry-title, \r\n.page-header h1, \r\n.entry-header h1,\r\n.vw-page-title,\r\n.page-header {\r\n    display: none !important;\r\n}\r\n\r\n.game-main-title {\r\n    display: block !important;\r\n    visibility: visible !important;\r\n    color: #d4af37 !important;\r\n    font-size: 2.5em !important;\r\n    text-align: center;\r\n    margin: 0 0 20px 0 !important;\r\n}\r\n\r\n.ui {\r\n    font-size: 20px;\r\n    color: #d4af37;\r\n    margin: 0 0 5px;\r\n    font-weight: bold;\r\n    width: 100%;\r\n    background: rgba(255, 255, 255, 0.1);\r\n    padding: 10px 20px;\r\n    border-radius: 50px;\r\n    text-align: center;\r\n    margin-bottom: 20px;\r\n    border: 1px solid #d4af37;\r\n    box-sizing: border-box;\r\n}\r\n\r\n.status-bar {\r\n    color: #fff;\r\n    font-size: 14px;\r\n    height: 18px;\r\n    margin-bottom: 5px;\r\n    font-style: italic;\r\n    width: 100%;\r\n    text-align: center;\r\n}\r\n\r\n.game-container {\r\n    display: flex;\r\n    justify-content: center;\r\n    align-items: flex-start; \/* Allinea perfettamente in alto la tabella e il canvas *\/\r\n    gap: 20px;\r\n    flex-wrap: nowrap; \/* Mantiene affiancati tabella e canvas su desktop *\/\r\n}\r\n\r\n\/* Wrapper del canvas (senza forzare 100% su desktop) *\/\r\n#game-wrapper {\r\n    display: flex !important;\r\n    flex-direction: column !important;\r\n    align-items: center !important;\r\n    justify-content: center !important;\r\n    box-sizing: border-box;\r\n}\r\n\r\n#instructions-table {\r\n    background: rgba(20, 20, 20, 0.9);\r\n    border: 1px solid #333;\r\n    padding: 15px;\r\n    width: 300px; \r\n    flex-shrink: 0; \/* Impedisce alla tabella di schiacciarsi *\/\r\n    text-align: left;\r\n    border-radius: 10px;\r\n    font-size: 13px;\r\n    color: #eee;\r\n    box-sizing: border-box;\r\n}\r\n\r\n#instructions-table h3 {\r\n    color: #d4af37;\r\n    margin-top: 0;\r\n    border-bottom: 1px solid #d4af37;\r\n    padding-bottom: 5px;\r\n}\r\n\r\n.timer-display {\r\n    color: #00ffff;\r\n    font-weight: bold;\r\n    margin-top: 15px;\r\n    font-size: 16px;\r\n    border-top: 1px solid #d4af37;\r\n    padding-top: 10px;\r\n}\r\n\r\n\r\ncanvas, #gameCanvas {\r\n    background: #000;\r\n    border: 3px solid #172c96;\r\n    display: block;\r\n    margin: 0 auto !important;\r\n    box-shadow: 0 0 20px #172c96;\r\n    cursor: crosshair;\r\n    max-width: 100% !important;\r\n    height: auto !important;\r\n    box-sizing: border-box;\r\n}\r\n\r\n#game-instructions {\r\n    background: rgba(0, 0, 0, 0.7);\r\n    border: 1px solid #d4af37;\r\n    border-radius: 8px;\r\n    padding: 20px;\r\n    margin-top: 30px;\r\n    color: #eee;\r\n    text-align: center;\r\n    max-width: 1000px;\r\n    box-sizing: border-box;\r\n}\r\n\r\n#game-instructions h3 {\r\n    color: #d4af37;\r\n    margin-top: 0;\r\n    text-align: center;\r\n    letter-spacing: 2px;\r\n}\r\n\r\ncanvas, #gameCanvas {\r\n    background: #000;\r\n    border: 3px solid #172c96;\r\n    display: block;\r\n    margin: 0 auto !important;\r\n    box-shadow: 0 0 20px #172c96;\r\n    cursor: crosshair;\r\n    max-width: 100% !important;\r\n    height: auto !important;\r\n    box-sizing: border-box;\r\n}\r\n\r\n#game-instructions {\r\n    background: rgba(0, 0, 0, 0.7);\r\n    border: 1px solid #d4af37;\r\n    border-radius: 8px;\r\n    padding: 20px;\r\n    margin-top: 30px;\r\n    color: #eee;\r\n    text-align: center;\r\n    max-width: 1000px;\r\n    box-sizing: border-box;\r\n}\r\n\r\n#game-instructions h3 {\r\n    color: #d4af37;\r\n    margin-top: 0;\r\n    text-align: center;\r\n    letter-spacing: 2px;\r\n}\r\n\r\n\/* --- CONTROLLI MOBILE (BARRE ORIZZONTALI) --- *\/\r\n#mobile-controls {\r\n    display: none; \r\n}\r\n\r\n#gameCanvas,\r\n#game-wrapper,\r\n#mobile-controls,\r\n#mobile-controls * {\r\n    -webkit-touch-callout: none !important;\r\n    -webkit-user-select: none !important;\r\n    user-select: none !important;\r\n    -webkit-tap-highlight-color: transparent !important;\r\n}\r\n\r\n@media (max-width: 768px) {\r\n    #zodiac-game-dark-theme {\r\n        padding: 15px 10px;\r\n        margin: 10px auto;\r\n        width: 100%;\r\n    }\r\n\r\n    .game-container {\r\n        flex-wrap: wrap; \/* Su mobile tornano impilati in colonna *\/\r\n    }\r\n\r\n    #game-wrapper {\r\n        width: 100% !important;\r\n        max-width: 100% !important;\r\n    }\r\n\r\n    #instructions-table {\r\n        width: 100% !important;\r\n        max-width: 100% !important;\r\n    }\r\n\r\n    #mobile-controls {\r\n        display: flex !important;\r\n        flex-direction: column;\r\n        align-items: center;\r\n        gap: 8px;\r\n        width: 100% !important;\r\n        max-width: 100% !important;\r\n        margin: 20px auto 10px auto !important;\r\n        box-sizing: border-box;\r\n        padding: 0 5px;\r\n    }\r\n\r\n    .mobile-row, .mobile-row-h {\r\n        width: 100% !important;\r\n        max-width: 100% !important;\r\n        box-sizing: border-box;\r\n    }\r\n\r\n    #instructions-table, #game-instructions {\r\n        width: 100% !important;\r\n        max-width: 100% !important;\r\n        box-sizing: border-box;\r\n        margin-left: 0 !important;\r\n        margin-right: 0 !important;\r\n    }\r\n\r\n    .mobile-row-h {\r\n        width: 100%;\r\n        display: flex;\r\n        justify-content: space-between;\r\n        gap: 12px;\r\n    }\r\n\r\n    .d-pad-bar {\r\n        background: #000000;\r\n        color: #ffffff;\r\n        border: 2px solid #d4af37;\r\n        border-radius: 8px;\r\n        font-size: 26px;\r\n        height: 50px;\r\n        display: flex;\r\n        align-items: center;\r\n        justify-content: center;\r\n        cursor: pointer;\r\n        box-sizing: border-box;\r\n        -webkit-tap-highlight-color: transparent;\r\n        -webkit-touch-callout: none;\r\n        user-select: none;\r\n    }\r\n\r\n    .mobile-row .d-pad-bar {\r\n        width: 100%;\r\n    }\r\n\r\n    .mobile-row-h .d-pad-bar {\r\n        flex: 1;\r\n    }\r\n}\r\n<\/style>\r\n<\/head>\r\n<body>\r\n\r\n<div id=\"zodiac-game-dark-theme\">\r\n<div style=\"font-family:'ZodiacFont'; opacity:0; height:0; position:absolute; pointer-events:none;\">\r\n        asdfghjklzxc\r\n    <\/div>\r\n<h1>Cosmic Escape: La Ruota del Destino<\/h1>\r\n<div class=\"ui\" style=\"text-align:center;\">\u2728 Punti: <span id=\"score\">0<\/span> | \u2764\ufe0f Vite: <span id=\"lives\">3<\/span><\/div>\r\n<div id=\"bonus-status\" class=\"status-bar\" style=\"text-align:center;\">Il cielo \u00e8 calmo...<\/div>\r\n<div class=\"game-container\">\r\n    <div id=\"instructions-table\">\r\n        <h3>Istruzioni e comandi<\/h3>\r\n        <div style=\"font-size: 12px; line-height: 1.6;\">\r\n            <p><strong>\u2643 Giove:<\/strong> Super Forza (20s)<\/p>\r\n            <p><strong>\u263f Mercurio:<\/strong> Magnetismo Punti<\/p>\r\n            <p><strong>\u2640 Venere:<\/strong> +1 Vita (Amore)<\/p>\r\n            <p><strong>\u2642 Marte:<\/strong> Aggressore (Danno)<\/p>\r\n            <p><strong>\u263e Luna:<\/strong> Confusione Lunare<\/p>\r\n            <p><strong>\u2645 Urano:<\/strong> +1000 Pts (Elettrico)<\/p>\r\n            <p><strong>\u2646 Nettuno:<\/strong> Miraggio Invisibile<\/p>\r\n            <p><strong>\u2647 Plutone:<\/strong> Il Guardiano Finale<\/p>\r\n        <\/div>\r\n        <div class=\"timer-display\">\r\n            <hr style=\"border: 0.5px solid #d4af37; margin: 10px 0;\">\r\n            Tempo: <span id=\"time-val\">0<\/span>s<br>\r\n            Asteroidi accesi: <span id=\"dots-count\">0<\/span><br>\r\n            Pianeti attivi: <span id=\"planets-count\">0<\/span>\r\n        <\/div>\r\n        <div id=\"start-msg\" style=\"text-align: center; color: #aaa; margin-top: 15px; font-family: sans-serif;\">\r\n            <p>\u2728 <strong>Ammira il tuo Cielo di Nascita<\/strong> \u2728<\/p>\r\n            <p style=\"font-size: 0.9em;\">Il tempo \u00e8 sospeso.<br>Usa le frecce per iniziare.<\/p>\r\n        <\/div>\r\n    <\/div>\r\n\r\n<div id=\"game-wrapper\">\r\n    <canvas id=\"gameCanvas\" width=\"600\" height=\"600\"><\/canvas>\r\n\r\n    <div id=\"mobile-controls\">\r\n        <div class=\"mobile-row\">\r\n            <button class=\"d-pad-bar\" type=\"button\" data-key=\"ArrowUp\" aria-label=\"Su\">\u25b2<\/button>\r\n        <\/div>\r\n        <div class=\"mobile-row-h\">\r\n            <button class=\"d-pad-bar\" type=\"button\" data-key=\"ArrowLeft\" aria-label=\"Sinistra\">\u25c0<\/button>\r\n            <button class=\"d-pad-bar\" type=\"button\" data-key=\"ArrowRight\" aria-label=\"Destra\">\u25b6<\/button>\r\n        <\/div>\r\n        <div class=\"mobile-row\">\r\n            <button class=\"d-pad-bar\" type=\"button\" data-key=\"ArrowDown\" aria-label=\"Gi\u00f9\">\u25bc<\/button>\r\n        <\/div>\r\n    <\/div>\r\n<\/div>\r\n\r\n\r\n<\/div>\r\n<div id=\"game-instructions\" style=\"text-align:center;\">\r\n    <h3>\u2728 GUIDA AL GIOCO \u2728<\/h3>\r\n    <div class=\"instructions-grid\">\r\n        <div class=\"inst-item\"><strong>Scopo:<\/strong> Assorbi tutti i 360 puntini (gradi) per completare l'orbita zodiacale.<\/div>\r\n        <div class=\"inst-item\"><strong>Super Forza:<\/strong> Raccogli <strong>Giove<\/strong> per diventare invulnerabile e respingere i pianeti.<\/div>\r\n        <div class=\"inst-item\"><strong>Bonus Armonia:<\/strong> Non distruggere i pianeti! Alla fine, otterrai <strong>1000 punti extra<\/strong> per ogni pianeta rimasto in cielo.<\/div>\r\n        <div class=\"inst-item\"><strong>Il Guardiano:<\/strong> Plutone protegge gli ultimi gradi. Appare solo quando la sfida si fa seria.<\/div>\r\n    <\/div>\r\n<\/div>  \r\n<\/div>  \r\n\r\n  \r\n<script>\r\nconst canvas = document.getElementById('gameCanvas');\r\nconst ctx = canvas.getContext('2d');\r\nconst scoreEl = document.getElementById('score');\r\nconst livesEl = document.getElementById('lives');\r\nconst bonusStatusEl = document.getElementById('bonus-status');\r\nconst timeValEl = document.getElementById('time-val');\r\nconst width = canvas.width;\r\nconst height = canvas.height;\r\n\r\n\r\n\/\/ --- DATI TRASMIGRATI ---\r\nconst soleNataleDeg = 0;\r\nconst natalPlanets  = [{\"type\":\"LUNA\",\"deg\":45,\"color\":\"#bdc3c7\",\"glyph\":\"\\u263d\",\"size\":18},{\"type\":\"MERCURIO\",\"deg\":12,\"color\":\"#2ecc71\",\"glyph\":\"\\u263f\",\"size\":15},{\"type\":\"VENERE\",\"deg\":310,\"color\":\"#ff69b4\",\"glyph\":\"\\u2640\",\"size\":18},{\"type\":\"MARTE\",\"deg\":200,\"color\":\"#ff4500\",\"glyph\":\"\\u2642\",\"size\":18},{\"type\":\"GIOVE\",\"deg\":120,\"color\":\"#f1c40f\",\"glyph\":\"\\u2643\",\"size\":22},{\"type\":\"SATURNO\",\"deg\":270,\"color\":\"#95a5a6\",\"glyph\":\"\\u2644\",\"size\":20},{\"type\":\"URANO\",\"deg\":55,\"color\":\"#34e7e4\",\"glyph\":\"\\u2645\",\"size\":18},{\"type\":\"NETTUNO\",\"deg\":340,\"color\":\"#00ffff\",\"glyph\":\"\\u2646\",\"size\":18},{\"type\":\"PLUTONE\",\"deg\":290,\"color\":\"#9b59b6\",\"glyph\":\"\\u2647\",\"size\":15}];\r\nconst cuspidiReali  = [0,30,60,90,120,150,180,210,240,270,300,330];\r\n\r\n\/\/ --- CONFIGURAZIONE GEOMETRICA ---\r\nconst centerX = 300, centerY = 300, outerRadius = 260, innerRadius = 80; \/\/ Aggiunto innerRadius qui!\r\n\r\n\/\/ --- FUNZIONE COORDINATE (Spostala in alto perch\u00e9 serve subito) ---\r\nfunction getCoords(degree, radius) {\r\n    const OFFSET_GRAFICO = 90-(270-cuspidiReali[0]); \r\n    let angle = (-degree + OFFSET_GRAFICO) * (Math.PI \/ 180);\r\n    return {\r\n        x: centerX + Math.cos(angle) * radius,\r\n        y: centerY + Math.sin(angle) * radius\r\n    };\r\n}\r\n\r\n\/\/ --- PLAYER SOLE E NEMICI ---\r\nconst startPos = getCoords(soleNataleDeg, innerRadius + 30);\r\nconst player = { \r\n    x: startPos.x, y: startPos.y, size: 20, speed: 4, glyph: '\\u2609', \r\n    isSuper: false, timerSuper: 0, isConfused: false, timerConfused: 0, \r\n    isParalyzed: false, timerParalyzed: 0, isInvulnerable: false, timerInvulnerable: 0,\r\n    isMagnetic: false, timerMagnetic: 0\r\n};\r\n\r\nlet enemies = natalPlanets.map(p => {\r\n    let coords = getCoords(p.deg, outerRadius - 40);\r\n    const isLento = ['URANO', 'NETTUNO', 'PLUTONE'].includes(p.type);\r\n    return {\r\n        ...p, \r\n        x: coords.x, y: coords.y,\r\n        speedX: isLento ? 0 : (Math.random() - 0.5) * 2.5,\r\n        speedY: isLento ? 0 : (Math.random() - 0.5) * 2.5,\r\n        isActiveBoss: false\r\n    };\r\n});\r\n\r\n\r\n\/\/const centerX = 300, centerY = 300, outerRadius = 260;\r\n\/\/let cuspidiReali = [254, 287, 325, 1, 30, 54, 74, 107, 145, 181, 210, 234]; \r\nlet gameStarted = false;\r\nlet score = 0, lives = 3, gameOver = false, frameCount = 0, secondsElapsed = 0;\r\nlet shockEffect = 0;\r\nconst keys = {};\r\n\r\n\/\/ 2. FUNZIONE DI CONVERSIONE (Formula originale dell'utente)\r\nfunction getCoords(degree, radius) {\r\n    const OFFSET_GRAFICO = 90-(270-cuspidiReali[0]); \r\n    let angle = (-degree + OFFSET_GRAFICO) * (Math.PI \/ 180);\r\n    return {\r\n        x: centerX + Math.cos(angle) * radius,\r\n        y: centerY + Math.sin(angle) * radius\r\n    };\r\n}\r\n\r\n\/\/ 4. INPUT E TIMER\r\nwindow.addEventListener('keydown', e => { \r\n    keys[e.code] = true; \r\n    if(e.code.includes('Arrow')) e.preventDefault(); \r\n    if(!gameStarted && e.code.includes('Arrow')) {\r\n        gameStarted = true;\r\n        document.getElementById('start-msg').style.display = 'none';\r\n    }\r\n});\r\nwindow.addEventListener('keyup', e => keys[e.code] = false);\r\n\r\nsetInterval(() => { if(!gameOver && gameStarted) { secondsElapsed++; timeValEl.innerText = secondsElapsed; } }, 1000);\r\n\r\n\/\/ 6. SIMBOLI E OGGETTI\r\nconst simboliSegni = ['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c'];\r\nlet dots = [];\r\n\r\nlet currentBonus = { active: false, x: 0, y: 0, type: '', color: '', glyph: '', timer: 0, size: 15 };\r\n\r\nfunction initDots() {\r\n    dots = [];\r\n    cuspidiReali.forEach((cI, i) => {\r\n        let cF = (i === 11) ? cuspidiReali[0] : cuspidiReali[i+1];\r\n        let mid = (cI < cF) ? (cI + cF) \/ 2 : (cI + cF + 360) \/ 2;\r\n        let rad = Math.PI - ((mid - cuspidiReali[0]) * Math.PI \/ 180);\r\n        for (let j = 1; j <= 8; j++) {\r\n            let d = (outerRadius * 0.7) * (j \/ 8);\r\n            dots.push({ x: centerX + Math.cos(rad)*d, y: centerY + Math.sin(rad)*d, signIndex: i, color: `hsl(${i*30}, 70%, 70%)` });\r\n        }\r\n    });\r\n}\r\n\r\nfunction update() {\r\n    if (gameOver || !gameStarted) return;\r\n    frameCount++;\r\n\r\n    \/\/ 1. MOVIMENTO PLAYER (Sole)\r\n    if (!player.isParalyzed) {\r\n        let s = player.isSuper ? 7 : 4;\r\n        let u = player.isConfused ? 'ArrowDown' : 'ArrowUp', d = player.isConfused ? 'ArrowUp' : 'ArrowDown';\r\n        let l = player.isConfused ? 'ArrowRight' : 'ArrowLeft', r = player.isConfused ? 'ArrowLeft' : 'ArrowRight';\r\n        if (keys[u]) player.y -= s; if (keys[d]) player.y += s; \r\n        if (keys[l]) player.x -= s; if (keys[r]) player.x += s;\r\n    } else if (--player.timerParalyzed <= 0) player.isParalyzed = false;\r\n    \r\n    if (player.isInvulnerable) if (--player.timerInvulnerable <= 0) player.isInvulnerable = false;\r\n\r\n    \/\/ 2. MAGNETISMO MERCURIO\r\n    if (player.isMagnetic) {\r\n        dots.forEach(d => {\r\n            let dist = Math.hypot(player.x - d.x, player.y - d.y);\r\n            if (dist < 180) {\r\n                let ang = Math.atan2(player.y - d.y, player.x - d.x);\r\n                d.x += Math.cos(ang) * 6; d.y += Math.sin(ang) * 6;\r\n            }\r\n        });\r\n        if (--player.timerMagnetic <= 0) player.isMagnetic = false;\r\n    }\r\n\r\n    \/\/ 3. CONFINI PLAYER\r\n    let distP = Math.hypot(player.x - centerX, player.y - centerY);\r\n    if (distP + player.size > outerRadius) {\r\n        let ang = Math.atan2(player.y - centerY, player.x - centerX);\r\n        player.x = centerX + Math.cos(ang) * (outerRadius - player.size);\r\n        player.y = centerY + Math.sin(ang) * (outerRadius - player.size);\r\n    }\r\n\r\n    if (player.isSuper && --player.timerSuper <= 0) player.isSuper = false;\r\n    if (player.isConfused && --player.timerConfused <= 0) player.isConfused = false;\r\n    \/\/ Rimosso shockEffect perch\u00e9 non disegniamo il cerchio\r\n\r\n    \/\/ 4. GESTIONE PIANETI (NEMICI)\r\n    enemies = enemies.filter((en) => {\r\n        if (!en || !en.type) return true; \r\n        let tipo = en.type.toUpperCase();\r\n\r\n        \/\/ URANO: Solo Repulsione Fisica (Niente Cerchio!)\r\n        if (tipo === 'URANO') {\r\n            if (score >= 300 && !en.isActiveBoss) {\r\n                en.isActiveBoss = true; en.speedX = 2; en.speedY = 1.5;\r\n                bonusStatusEl.innerText = \"Urano si \u00e8 svegliato! Ti respinge!\";\r\n            }\r\n            if (en.isActiveBoss) {\r\n                let distUrano = Math.hypot(player.x - en.x, player.y - en.y);\r\n                \/\/ Il Sole viene spinto via se si avvicina troppo (raggio 120)\r\n                if (distUrano < 120) { \r\n                    let repAng = Math.atan2(player.y - en.y, player.x - en.x);\r\n                    player.x += Math.cos(repAng) * 6; \/\/ Spinta via\r\n                    player.y += Math.sin(repAng) * 6;\r\n                }\r\n            }\r\n        }\r\n\r\n        \/\/ NETTUNO: Scompare e riappare\r\n        if (tipo === 'NETTUNO') {\r\n            if (score >= 600 && !en.isActiveBoss) {\r\n                en.isActiveBoss = true; en.speedX = 1.5; en.speedY = 2;\r\n                bonusStatusEl.innerText = \"Nettuno scompare e riappare!\";\r\n            }\r\n            if (en.isActiveBoss) {\r\n                if (frameCount % 180 === 0) { \/\/ Teletrasporto ogni 3 secondi\r\n                    let a = Math.random() * Math.PI * 2, d = Math.random() * (outerRadius - 50);\r\n                    en.x = centerX + Math.cos(a) * d; en.y = centerY + Math.sin(a) * d;\r\n                }\r\n            }\r\n        }\r\n\r\n        \/\/ PLUTONE: Pulsazione\r\n\t\t\/\/ PLUTONE: Si sveglia a 1000 punti o quando mancano pochi puntini\r\n\t\tif (tipo === 'PLUTONE') {\r\n\t\tif ((score >= 1000 || dots.length < 20) && !en.isActiveBoss) {\r\n        en.isActiveBoss = true;\r\n        \/\/ ASSEGNA VELOCIT\u00c0 INIZIALE se \u00e8 fermo\r\n        en.speedX = (Math.random() > 0.5 ? 1.5 : -1.5);\r\n        en.speedY = (Math.random() > 0.5 ? 1.5 : -1.5);\r\n        bonusStatusEl.innerText = \"Plutone si muove! Il Guardiano \u00e8 attivo!\";\r\n\t\t}\r\n    \r\n\t\tif (en.isActiveBoss) {\r\n        \/\/ Pulsazione (gi\u00e0 presente nel tuo draw)\r\n        en.size = 20 + Math.sin(frameCount * 0.1) * 8;\r\n        \r\n        \/\/ MOVIMENTO EXTRA: Plutone insegue lentamente il giocatore?\r\n        \/\/ Se vuoi che sia cattivo, aggiungi queste due righe:\r\n        let angleToPlayer = Math.atan2(player.y - en.y, player.x - en.x);\r\n        en.x += Math.cos(angleToPlayer) * 0.5; \r\n        en.y += Math.sin(angleToPlayer) * 0.5;\r\n\t\t}\r\n}\r\n\r\n        \/\/ Movimento (Boss attivi e Pianeti Veloci)\r\n\t\t\/\/ Applica movimento se il boss \u00e8 attivo O se \u00e8 un pianeta comune (che ha gi\u00e0 velocit\u00e0)\r\n\t\tif (en.isActiveBoss || (tipo !== 'URANO' && tipo !== 'NETTUNO' && tipo !== 'PLUTONE')) {\r\n\t\t\ten.x += en.speedX;\r\n\t\t\ten.y += en.speedY;\r\n\t\t}\r\n        \r\n\t\t\/\/ Rimbalzo bordi\r\n        let distCenter = Math.hypot(en.x - centerX, en.y - centerY);\r\n        if (distCenter + 15 > outerRadius) {\r\n            let ang = Math.atan2(en.y - centerY, en.x - centerX);\r\n            let nx = Math.cos(ang), ny = Math.sin(ang);\r\n            let dot = en.speedX * nx + en.speedY * ny;\r\n            en.speedX -= 2 * dot * nx; en.speedY -= 2 * dot * ny;\r\n            en.x = centerX + nx * (outerRadius - 20); \r\n            en.y = centerY + ny * (outerRadius - 20);\r\n        }\r\n\r\n        \/\/ --- COLLISIONI ---\r\n        let distCol = Math.hypot(player.x - en.x, player.y - en.y);\r\n        if (distCol < player.size + en.size) {\r\n            if (tipo === 'GIOVE') { player.isSuper = true; player.timerSuper = 1200; bonusStatusEl.innerText = \"GIOVE: Super Forza!\"; score += 500; return false; }\r\n            if (tipo === 'MERCURIO') { player.isMagnetic = true; player.timerMagnetic = 600; score += 300; bonusStatusEl.innerText = \"MERCURIO: Magnetismo!\"; return false; }\r\n            if (tipo === 'VENERE') { if (lives < 5) { lives++; livesEl.innerText = lives; } bonusStatusEl.innerText = \"VENERE: +1 Vita!\"; return false; }\r\n            \r\n\/\/ --- SCONTRO CON PLUTONE (Vittoria) ---\r\nif (tipo === 'PLUTONE' && dots.length === 0) {\r\n    score += 2000;\r\n    gameOver = true; \r\n    \r\n    \/\/ Usiamo canvas.width e canvas.height invece di variabili generiche\r\n    ctx.fillStyle = \"rgba(0,0,0,0.8)\";\r\n    ctx.fillRect(0, 0, canvas.width, canvas.height); \r\n    \r\n    ctx.fillStyle = \"#ffd700\"; \r\n    ctx.font = \"bold 50px Arial\";\r\n    ctx.textAlign = \"center\";\r\n    ctx.fillText(\"VITTORIA!\", centerX, centerY - 20);\r\n    \r\n    ctx.fillStyle = \"white\";\r\n    ctx.font = \"30px Arial\";\r\n    ctx.fillText(\"Punteggio Finale: \" + score, centerX, centerY + 30);\r\n    \r\n    \/\/setTimeout(() => { alert(\"\u2728 VITTORIA NATALE! \u2728\\nPunteggio: \" + score); }, 100);\r\n    return false;\r\n}\r\n\r\n            \/\/ Scontro Semplice\r\n            if (player.isSuper) {\r\n                score += 500; bonusStatusEl.innerText = \"Trasmutato \" + tipo; return false;\r\n            } else if (!player.isInvulnerable) {\r\n                lives--; livesEl.innerText = lives;\r\n                if (lives <= 0) {\r\n                    gameOver = true;\r\n                    ctx.fillStyle = \"rgba(0,0,0,0.8)\"; ctx.fillRect(0,0,width,height);\r\n                    ctx.fillStyle = \"red\"; ctx.font = \"bold 50px Arial\"; ctx.textAlign = \"center\";\r\n                    ctx.fillText(\"GAME OVER\", centerX, centerY);\r\n                    \/\/setTimeout(() => { alert(\"GAME OVER - Il Destino ha vinto.\"); }, 100);\r\n                    return true;\r\n                }\r\n                player.isInvulnerable = true; player.timerInvulnerable = 120;\r\n                player.isParalyzed = true; player.timerParalyzed = 40;\r\n                en.speedX *= -1.2; en.speedY *= -1.2;\r\n            }\r\n        }\r\n        return true;\r\n    });\r\n\r\n    \/\/ 5. PUNTINI\r\n    dots = dots.filter(d => {\r\n        if (Math.hypot(player.x - d.x, player.y - d.y) < player.size + 10) { \r\n            score += 10; scoreEl.innerText = score; return false; \r\n        }\r\n        return true;\r\n    });\r\n\r\n    \/\/ 6. UI\r\n    document.getElementById('dots-count').innerText = dots.length;\r\n    document.getElementById('planets-count').innerText = enemies.length;\r\n    \r\n\/\/ ... fine della logica dei puntini ...\r\n\r\n    \/\/ 6. UI\r\n    document.getElementById('dots-count').innerText = dots.length;\r\n    document.getElementById('planets-count').innerText = enemies.length;\r\n\r\n    \/\/ --- NUOVO CONTROLLO VITTORIA (Sostituisce i due blocchi precedenti) ---\r\n    if (dots.length === 0 && !gameOver) {\r\n        gameOver = true;\r\n\r\n        \/\/ 1. Calcolo Bonus Armonia: 1000 punti per ogni pianeta rimasto\r\n        const superstiti = enemies.filter(en => en && en.type).length;\r\n        const bonusTotale = superstiti * 1000;\r\n        score += bonusTotale;\r\n        scoreEl.innerText = score; \/\/ Aggiorna il punteggio sulla barra in alto\r\n\r\n        \/\/ 2. Disegno Schermata Finale\r\n        ctx.save();\r\n        ctx.setTransform(1, 0, 0, 1, 0, 0); \/\/ Reset trasformazioni per sicurezza\r\n        ctx.fillStyle = \"rgba(0,0,0,0.85)\";\r\n        ctx.fillRect(0, 0, canvas.width, canvas.height);\r\n        \r\n        ctx.textAlign = \"center\";\r\n        ctx.textBaseline = \"middle\";\r\n        \r\n        ctx.fillStyle = \"#ffd700\";\r\n        ctx.font = \"bold 50px Arial\";\r\n        ctx.fillText(\"VITTORIA!!!\", centerX, centerY - 50);\r\n        \r\n        ctx.fillStyle = \"white\";\r\n        ctx.font = \"22px Arial\";\r\n        ctx.fillText(\"Pianeti rimasti in armonia: \" + superstiti, centerX, centerY + 10);\r\n        ctx.fillText(\"Bonus Armonia: +\" + bonusTotale + \" punti\", centerX, centerY + 45);\r\n        \r\n        ctx.fillStyle = \"#ffd700\";\r\n        ctx.font = \"bold 35px Arial\";\r\n        ctx.fillText(\"PUNTEGGIO TOTALE: \" + score, centerX, centerY + 100);\r\n        ctx.restore();\r\n    }\r\n} \/\/ Fine della funzione update\r\n\t\r\n\r\n\r\nfunction draw() {\r\n    ctx.clearRect(0, 0, canvas.width, canvas.height);\r\n\r\n    \/\/ 1. CERCHIO ESTERNO E CASE (Linee Blu)\r\n    ctx.strokeStyle = \"#172c96\"; \r\n    ctx.lineWidth = 5; \r\n    ctx.beginPath(); \r\n    ctx.arc(centerX, centerY, outerRadius, 0, Math.PI * 2); \r\n    ctx.stroke();\r\n    \r\n    cuspidiReali.forEach((cI, i) => {\r\n        \/\/ Formula originale per l'allineamento delle linee\r\n        let sA = (180 - (cI - cuspidiReali[0])) * (Math.PI \/ 180);\r\n        ctx.strokeStyle = \"rgba(23, 44, 150, 0.4)\"; \r\n        ctx.lineWidth = 2;\r\n        ctx.beginPath(); \r\n        ctx.moveTo(centerX, centerY); \r\n        ctx.lineTo(centerX + Math.cos(sA) * outerRadius, centerY + Math.sin(sA) * outerRadius); \r\n        ctx.stroke();\r\n    });\r\n\r\n    \/\/ 2. SEGNI ZODIACALI (Allineati esattamente sulle linee delle case)\r\n    ctx.textAlign = \"center\"; \r\n    ctx.textBaseline = \"middle\";\r\n    let segnoAscendente = Math.floor(cuspidiReali[0] \/ 30);\r\n\r\n    for (let i = 0; i < 12; i++) {\r\n        \/\/ Angolo identico a quello delle linee blu (sA)\r\n        let gradiRelativi = i * 30; \r\n        let angSign = (180 - gradiRelativi) * (Math.PI \/ 180);\r\n        let indiceSegnoCorretto = (segnoAscendente + i) % 12;\r\n        \r\n        \/\/ Colore dinamico: trasparente se ci sono puntini, oro se mangiati\r\n        let hasDots = dots.some(d => d.signIndex === i);\r\n        ctx.fillStyle = hasDots ? \"rgba(255,255,255,0.2)\" : \"#d4af37\";\r\n        ctx.font = \"30px 'ZodiacFont', Arial\";\r\n\t\t\r\n        \r\n        \/\/ Posizionati leggermente all'esterno (0.94 del raggio)\r\n        ctx.fillText(\r\n            simboliSegni[indiceSegnoCorretto], \r\n            centerX + Math.cos(angSign) * outerRadius * 0.94, \r\n            centerY + Math.sin(angSign) * outerRadius * 0.94\r\n        );\r\n    }\r\n\r\n    \/\/ 3. PUNTINI (I gradi dello zodiaco)\r\n    dots.forEach(d => { \r\n        ctx.fillStyle = d.color; \r\n        ctx.beginPath(); \r\n        ctx.arc(d.x, d.y, 3, 0, Math.PI * 2); \r\n        ctx.fill(); \r\n    });\r\n\r\n    \/\/ 4. NEMICI (Pianeti) - Fix Urano, Nettuno e Plutone\r\n    enemies.forEach(en => {\r\n        ctx.save();\r\n        let tipo = en.type.toUpperCase();\r\n\r\n        \/\/ Calcolo posizione iniziale se non definita o se il pianeta \u00e8 fermo\r\n        \/\/ FIX: Usiamo en.deg che arriva correttamente dal PHP\r\n        if (en.x === undefined || en.y === undefined || (en.speedX === 0 && !en.isActiveBoss)) {\r\n            let deltaGradi = (en.deg - cuspidiReali[0] + 360) % 360;\r\n            let angPianeta = (180 - deltaGradi) * (Math.PI \/ 180);\r\n            en.x = centerX + Math.cos(angPianeta) * (outerRadius * 0.75);\r\n            en.y = centerY + Math.sin(angPianeta) * (outerRadius * 0.75);\r\n        }\r\n\r\n        \/\/ Effetto Urano (Ellisse elettrica rotante)\r\n        if (tipo === 'URANO' && en.isActiveBoss) {\r\n            ctx.strokeStyle = \"rgba(0, 255, 255, \" + (0.4 + Math.sin(frameCount * 0.1) * 0.2) + \")\";\r\n            ctx.lineWidth = 2;\r\n            ctx.setLineDash([5, 5]);\r\n            ctx.beginPath();\r\n            ctx.ellipse(en.x, en.y, 25, 45, frameCount * 0.02, 0, Math.PI * 2);\r\n            ctx.stroke();\r\n            ctx.setLineDash([]);\r\n        }\r\n        \r\n        \/\/ Effetto Nettuno (Aura eterea)\r\n        if (tipo === 'NETTUNO') {\r\n            ctx.shadowBlur = 15;\r\n            ctx.shadowColor = \"#00ffff\";\r\n            ctx.globalAlpha = en.isActiveBoss ? (en.opacity || 0.8) : 0.6;\r\n        }\r\n        \r\n        \/\/ Effetto Plutone (Aura viola e dimensioni variabili)\r\n        if (tipo === 'PLUTONE') {\r\n            ctx.shadowBlur = 20;\r\n            ctx.shadowColor = \"#ff00ff\"; \r\n            if (en.isActiveBoss) {\r\n                ctx.strokeStyle = \"#ff00ff\";\r\n                ctx.lineWidth = 2;\r\n                ctx.beginPath(); \r\n                ctx.arc(en.x, en.y, en.size + 12, 0, Math.PI * 2); \r\n                ctx.stroke();\r\n            }\r\n        }\r\n\r\n        \/\/ Disegno Glifo Pianeta\r\n        ctx.fillStyle = en.color;\r\n        ctx.font = (tipo === 'PLUTONE' ? \"35px\" : \"30px\") + \" Arial\";\r\n        ctx.textAlign = \"center\";\r\n        ctx.textBaseline = \"middle\";\r\n        ctx.fillText(en.glyph, en.x, en.y);\r\n        ctx.restore();    \r\n    });\r\n\r\n    \/\/ 5. BONUS E SCOSSA\r\n    if (currentBonus && currentBonus.active) {\r\n        ctx.fillStyle = currentBonus.color; \r\n        ctx.font = \"30px Arial\";\r\n        ctx.textAlign = \"center\";\r\n        ctx.fillText(currentBonus.glyph, currentBonus.x, currentBonus.y);\r\n    }\r\n\r\n    if (shockEffect > 0) {\r\n        ctx.strokeStyle = \"#00ffff\"; \r\n        ctx.lineWidth = 2;\r\n        for (let i = 0; i < 6; i++) {\r\n            ctx.beginPath(); \r\n            ctx.moveTo(player.x, player.y);\r\n            ctx.lineTo(player.x + (Math.random() - 0.5) * 100, player.y + (Math.random() - 0.5) * 100); \r\n            ctx.stroke();\r\n        }\r\n    }\r\n\r\n    \/\/ 6. PLAYER (SOLE) - Disegnato per ultimo per stare sopra a tutto\r\n    ctx.save();\r\n    if (player.isInvulnerable && frameCount % 10 < 5) ctx.globalAlpha = 0.3;\r\n    \r\n    \/\/ Bagliore solare\r\n    let r = player.size + Math.sin(frameCount * 0.1) * 3;\r\n    let glow = ctx.createRadialGradient(player.x, player.y, 2, player.x, player.y, r + 15);\r\n    glow.addColorStop(0, \"#fff\"); \r\n    glow.addColorStop(0.4, player.isSuper ? \"#ffd700\" : \"#ffff00\"); \r\n    glow.addColorStop(1, \"transparent\");\r\n    \r\n    ctx.fillStyle = glow;\r\n    ctx.beginPath(); \r\n    ctx.arc(player.x, player.y, r + 15, 0, Math.PI * 2); \r\n    ctx.fill();\r\n    \r\n    \/\/ Glifo \u2609 al centro\r\n    ctx.textAlign = \"center\"; \r\n    ctx.textBaseline = \"middle\";\r\n    ctx.shadowColor = \"white\"; \r\n    ctx.shadowBlur = 5; \r\n    ctx.fillStyle = \"black\";\r\n    ctx.font = \"bold 16px Arial\"; \r\n    ctx.fillText(\"\u2609\", player.x, player.y);\r\n    ctx.restore();\r\n\r\n    \/\/ 7. SCHERMATA FINALE\r\n    if (gameOver) {\r\n        ctx.save();\r\n        ctx.fillStyle = \"rgba(0, 0, 0, 0.8)\"; \r\n        ctx.fillRect(0, 0, canvas.width, canvas.height);\r\n        ctx.textAlign = \"center\"; \r\n        ctx.textBaseline = \"middle\";\r\n        ctx.fillStyle = (lives <= 0) ? \"#ff0000\" : \"#ffd700\"; \r\n        ctx.font = \"bold 50px Arial\";\r\n        ctx.fillText(lives <= 0 ? \"GAME OVER\" : \"VITTORIA!!!\", centerX, centerY);\r\n        ctx.restore();\r\n    } else {\r\n        requestAnimationFrame(draw);\r\n    }\r\n}\r\n\r\n\r\nfunction endGame(m) {\r\n    gameOver = true;\r\n\r\n    \/\/ 1. Calcolo del Bonus Armonia (1500 punti per ogni pianeta non mangiato)\r\n    \/\/ Escludiamo Plutone dal conteggio dei superstiti se \u00e8 stato rimosso\r\n    const superstiti = enemies.filter(en => en.type !== 'PLUTONE').length;\r\n    const bonusTotale = superstiti * 1500;\r\n    score += bonusTotale;\r\n\r\n    \/\/ 2. Aggiorniamo l'interfaccia HTML del punteggio\r\n    scoreEl.innerText = score;\r\n\r\n    \/\/ 3. Grafica finale sul Canvas\r\n    ctx.fillStyle = \"rgba(0,0,0,0.85)\"; \/\/ Leggermente pi\u00f9 scuro per leggere meglio\r\n    ctx.fillRect(0, 0, 600, 600);\r\n    \r\n    ctx.textAlign = \"center\";\r\n    \r\n    \/\/ Titolo (Vittoria o Sconfitta)\r\n    ctx.fillStyle = \"#d4af37\";\r\n    ctx.font = \"bold 35px Arial\";\r\n    ctx.fillText(m, centerX, centerY - 40);\r\n    \r\n    \/\/ Dettaglio Bonus\r\n    ctx.font = \"20px Arial\";\r\n    ctx.fillStyle = \"#ffffff\";\r\n    ctx.fillText(\"Pianeti salvati: \" + superstiti, centerX, centerY + 10);\r\n    ctx.fillText(\"Bonus Armonia: +\" + bonusTotale, centerX, centerY + 40);\r\n    \r\n    \/\/ Punteggio Finale\r\n    ctx.font = \"bold 30px Arial\";\r\n    ctx.fillStyle = \"#d4af37\";\r\n    ctx.fillText(\"PUNTEGGIO TOTALE: \" + score, centerX, centerY + 90);\r\n}\r\n\r\n\/\/ IL VERO CUORE DEL GIOCO\r\nfunction gameLoop() {\r\n    if (!gameOver) {\r\n        update(); \/\/ Gestisce la logica\r\n        draw();   \/\/ Gestisce la grafica\r\n        requestAnimationFrame(gameLoop); \/\/ Prenota il prossimo frame\r\n    }\r\n}\r\n\r\n\/\/ AVVIO UNICO\r\ninitDots();\r\nrequestAnimationFrame(gameLoop);\r\n\r\n\r\n\/\/ Forza la sparizione del titolo del tema al caricamento della pagina\r\nwindow.addEventListener('load', function() {\r\n    const titoliTema = document.querySelectorAll('.vw-page-title');\r\n    titoliTema.forEach(el => {\r\n        el.style.display = 'none';\r\n        el.setAttribute('style', 'display: none !important');\r\n    });\r\n});\r\n\r\nfunction getMousePos(canvas, evt) {\r\n    var rect = canvas.getBoundingClientRect();\r\n    \/\/ Calcola il rapporto di scala tra la dimensione reale (600) e quella visualizzata (rect.width)\r\n    var scaleX = canvas.width \/ rect.width;\r\n    var scaleY = canvas.height \/ rect.height;\r\n    \r\n    return {\r\n        x: (evt.clientX - rect.left) * scaleX,\r\n        y: (evt.clientY - rect.top) * scaleY\r\n    };\r\n}\r\n\r\n\/\/ Gestione D-Pad Mobile (aggiornato per la classe .d-pad-bar)\r\nconst dPadButtons = document.querySelectorAll('.d-pad-bar');\r\n\r\ndPadButtons.forEach(btn => {\r\n    const key = btn.dataset.key;\r\n\r\n    \/\/ Supporto per il tocco (Mobile) e clic (Desktop\/Emulazione)\r\n    ['touchstart', 'mousedown'].forEach(evtType => {\r\n        btn.addEventListener(evtType, (e) => {\r\n            e.preventDefault();\r\n            keys[key] = true;\r\n            \r\n            if(!gameStarted) {\r\n                gameStarted = true;\r\n                const startMsg = document.getElementById('start-msg');\r\n                if(startMsg) startMsg.style.display = 'none';\r\n            }\r\n        }, { passive: false });\r\n    });\r\n\r\n    ['touchend', 'mouseup', 'mouseleave'].forEach(evtType => {\r\n        btn.addEventListener(evtType, (e) => {\r\n            e.preventDefault();\r\n            keys[key] = false;\r\n        });\r\n    });\r\n});\r\n\r\n<\/script>\r\n\r\n<\/body>\r\n<\/html>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-25","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/astro.newgenesys.eu\/index.php\/wp-json\/wp\/v2\/pages\/25","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/astro.newgenesys.eu\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/astro.newgenesys.eu\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/astro.newgenesys.eu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/astro.newgenesys.eu\/index.php\/wp-json\/wp\/v2\/comments?post=25"}],"version-history":[{"count":1,"href":"https:\/\/astro.newgenesys.eu\/index.php\/wp-json\/wp\/v2\/pages\/25\/revisions"}],"predecessor-version":[{"id":26,"href":"https:\/\/astro.newgenesys.eu\/index.php\/wp-json\/wp\/v2\/pages\/25\/revisions\/26"}],"wp:attachment":[{"href":"https:\/\/astro.newgenesys.eu\/index.php\/wp-json\/wp\/v2\/media?parent=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}