GeometryDash.com Speedhack

Speedhack mod for the Geometry Dash Web version.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         GeometryDash.com Speedhack
// @namespace    YouTubeDrawaria
// @version      12.0.1
// @description  Speedhack mod for the Geometry Dash Web version.
// @author       YouTubeDrawaria
// @match        *://*.geometrydash.com/game/*
// @match        *://geometrydash.com/demo*
// @grant        none
// @run-at       document-start
// @icon https://geometrydash.com/favicon.ico
 // @license MIT
// ==/UserScript==

(function () {
    'use strict';

    console.log("[GD Speedhack] Iniciando módulo de tiempo estable...");

    // Estado global de la velocidad
    const State = {
        speedhack: 1.0
    };

    // ==========================================
    // 1. SPEEDHACK (Secuestro de RAF)
    // ==========================================
    // Esta es la joya de la corona que engaña al navegador entero
    const originalRAF = window.requestAnimationFrame;
    let lastTime = performance.now();

    window.requestAnimationFrame = function(callback) {
        return originalRAF(function(time) {
            if (State.speedhack !== 1.0) {
                const delta = time - lastTime;
                // Dilatación o contracción del tiempo matemático
                time = lastTime + (delta * State.speedhack);
            }
            lastTime = time;
            callback(time);
        });
    };

    // ==========================================
    // 2. SINCRONIZACIÓN DE AUDIO PITCH
    // ==========================================
    // Mantiene la música a la misma velocidad que el juego
    setInterval(() => {
        if (window.game && window.game.scene) {
            const activeScene = window.game.scene.scenes.find(s => s.sys.isActive());
            if (activeScene && activeScene.sound) {
                activeScene.sound.getAllPlaying().forEach(s => {
                    // Solo actualizamos si la velocidad es diferente para no saturar
                    if (s.rate !== State.speedhack) {
                        s.setRate(State.speedhack);
                    }
                });
            }
        }
    }, 100);

    // ==========================================
    // 3. INTERFAZ DE USUARIO (MINIMALISTA)
    // ==========================================
    function crearUI() {
        if (document.getElementById('mh-speed-ui')) return;

        const style = document.createElement('style');
        style.innerHTML = `
            #mh-speed-ui {
                position: fixed; top: 15px; left: 15px; width: 250px;
                background: #0b1a2a; border: 2px solid #1abc9c; border-radius: 8px;
                font-family: 'Arial', sans-serif; color: white; z-index: 9999999;
                user-select: none; box-shadow: 0 0 15px rgba(0,0,0,0.7);
            }
            .mh-header {
                background: #1abc9c; padding: 10px; font-weight: bold; font-size: 14px;
                display: flex; justify-content: space-between; cursor: move;
                border-radius: 6px 6px 0 0; text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
            }
            .mh-content { padding: 15px; }
            .mh-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
            .mh-slider { width: 100%; cursor: pointer; margin-top: 10px; }
        `;
        document.head.appendChild(style);

        const menu = document.createElement('div');
        menu.id = 'mh-speed-ui';
        menu.innerHTML = `
            <div class="mh-header" id="mh-drag">
                <span>⏱️ GD Speedhack</span>
                <span id="mh-close" style="cursor:pointer">✖</span>
            </div>
            <div class="mh-content">
                <div class="mh-row">
                    <span>Speed:</span>
                    <span id="val-speed" style="color:#00ff00; font-weight:bold;">1.0x</span>
                </div>
                <input type="range" class="mh-slider" id="ui-speed" min="0.1" max="3" step="0.1" value="1">
            </div>
        `;
        document.body.appendChild(menu);

        // Eventos del Slider
        document.getElementById('ui-speed').oninput = e => {
            State.speedhack = parseFloat(e.target.value);
            document.getElementById('val-speed').innerText = State.speedhack.toFixed(1) + 'x';
        };

        // Lógica para arrastrar el menú
        const header = document.getElementById('mh-drag');
        let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
        header.onmousedown = e => {
            if(e.target.id === 'mh-close') return;
            e.preventDefault();
            pos3 = e.clientX; pos4 = e.clientY;
            document.onmouseup = () => { document.onmouseup = null; document.onmousemove = null; };
            document.onmousemove = e => {
                e.preventDefault();
                pos1 = pos3 - e.clientX; pos2 = pos4 - e.clientY;
                pos3 = e.clientX; pos4 = e.clientY;
                menu.style.top = Math.max(0, menu.offsetTop - pos2) + "px";
                menu.style.left = Math.max(0, menu.offsetLeft - pos1) + "px";
            };
        };

        document.getElementById('mh-close').onclick = () => menu.style.display = 'none';
    }

    // Iniciar UI
    window.addEventListener('DOMContentLoaded', () => setTimeout(crearUI, 1000));
})();