-- name: Eje Invertido y Vuelo Libre (ALGORITMO SUPER COSMICISIMO)
-- description: Vuelo 3D vectorial cuántico (Arriba=Subir). Hiper-Velocidad con A, Supernova con B, Levitación Estacionaria e Inmunidad Absoluta. Capa con L.
local FLIGHT_SPEED = 40.0 -- Velocidad de crucero horizontal
local COSMIC_SPEED = 120.0 -- Velocidad de la luz con el botón A
local VERTICAL_SPEED = 30.0 -- Sensibilidad vertical cuántica
local SWIM_SPEED_VAL = 20.0 -- Fuerza de nado vertical cósmica
local lButtonPressed = false
local isCustomFlying = false
-------------------------------------------------------------------------
-- 1. DEFENSAS CUÁNTICAS E INTERRUPTOR CÓSMICO (BOTÓN L)
-------------------------------------------------------------------------
hook_event(HOOK_BEFORE_PHYS_STEP, function(m)
if m.playerIndex ~= 0 then return end
-- BOTÓN L: Equipar/Desequipar Capa al Instante
if (m.controller.buttonPressed & L_TRIG) ~= 0 then
if not lButtonPressed then
lButtonPressed = true
if (m.flags & MARIO_WING_CAP) ~= 0 then
m.flags = m.flags & ~MARIO_WING_CAP
m.capTimer = 0
isCustomFlying = false
if m.action == ACT_FLYING then
m.action = ACT_FREE_FALL
end
play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, m.marioObj.header.gfx.cameraToObject)
else
m.flags = m.flags | MARIO_WING_CAP
m.capTimer = 9000
spawn_mist_particles()
play_sound(SOUND_MENU_CAMERA_ZOOM_IN, m.marioObj.header.gfx.cameraToObject)
end
end
else
lButtonPressed = false
end
if (m.flags & MARIO_WING_CAP) == 0 then
isCustomFlying = false
end
-- INMUNIDAD TOTAL: Curación cuántica instantánea ante cualquier peligro del mapa
m.health = 0x0880
if m.action == ACT_FEET_FIRST_LAVA_LAND or m.action == ACT_LAVA_BOOST or
m.action == ACT_DEATH_EXIT or m.action == ACT_FALLING_DEATH_EXIT or m.action == ACT_WATER_DEATH then
m.pos.y = m.pos.y + 1000 -- Teletransportar al cielo si cae al vacío
m.action = ACT_FLYING
isCustomFlying = true
end
end)
-------------------------------------------------------------------------
-- 2. NÚCLEO DE FÍSICA TRIDIMENSIONAL VECTORIAL (ALGORITMO CÓSMICO)
-------------------------------------------------------------------------
hook_event(HOOK_BEFORE_PHYS_STEP, function(m)
if m.playerIndex ~= 0 then return end
-- Activación estricta y perfecta mediante el Triple Salto nativo del juego
if m.action == ACT_FLYING and not isCustomFlying then
isCustomFlying = true
play_sound(SOUND_ACTION_FLYING_WING_CAP, m.marioObj.header.gfx.cameraToObject)
end
-- Cancelación si entra al agua o si decide pararse de forma voluntaria en tierra firme
if (m.action & ACT_FLAG_STATIONARY) ~= 0 and m.intendedMag == 0 and not isCustomFlying then
isCustomFlying = false
elseif (m.action & ACT_FLAG_SWIMMING) ~= 0 then
isCustomFlying = false
end
-------------------------------------------------------------------------
-- MOTOR VECTORIAL ESPACIAL (VUELO LIBRE TOTAL)
-------------------------------------------------------------------------
if isCustomFlying then
m.action = ACT_FLYING
m.peakHeight = m.pos.y -- Desactivar contador de daño por impacto
-- Captura de variables cuánticas
local stickY = m.controller.stickY / 64.0
local isCosmicActive = (m.controller.buttonDown & A_BUTTON) ~= 0
local isSupernovaActive = (m.controller.buttonPressed & B_BUTTON) ~= 0
local currentSpeed = isCosmicActive and COSMIC_SPEED or FLIGHT_SPEED
-- ATAQUE CÓSMICO: SUPERNOVA EXPANSIVA (BOTÓN B)
if isSupernovaActive then
play_sound(SOUND_OBJ_BOWSER_WALK, m.marioObj.header.gfx.cameraToObject)
play_sound(SOUND_GENERAL2_BOWSER_EXPLODE, m.marioObj.header.gfx.cameraToObject)
spawn_mist_particles()
-- Invocar una onda expansiva masiva de Bowser que elimina todo a tu paso
local wave = spawn_object(m.marioObj, MODEL_BOWSER_WAVE, bhvBowserShockWave)
if wave then
wave.oPosX, wave.oPosY, wave.oPosZ = m.pos.x, m.pos.y, m.pos.z
end
end
-- EJE Y TOTALMENTE RECTIFICADO (Palanca hacia arriba = Mario asciende velozmente)
m.faceAngle.pitch = math.floor(-stickY * 0x1C00)
-- Cálculo del ángulo horizontal (Yaw)
if m.intendedMag > 0 then
m.faceAngle.yaw = m.intendedYaw
m.forwardVel = currentSpeed * math.cos(m.faceAngle.pitch / 32768.0 * math.pi)
else
-- LEVITACIÓN ESTACIONARIA: Si no tocas la palanca, Mario se suspende en el espacio
m.forwardVel = 0
end
-- Trigonometría orbital pura para desplazamientos tridimensionales perfectos
local pitchRadians = m.faceAngle.pitch / 32768.0 * math.pi
local yawRadians = m.faceAngle.yaw / 32768.0 * math.pi
m.vel.y = -math.sin(pitchRadians) * VERTICAL_SPEED
m.vel.x = m.forwardVel * math.sin(yawRadians)
m.vel.z = m.forwardVel * math.cos(yawRadians)
-- Inyección directa a las coordenadas globales respetando la geometría de los niveles
m.pos.x = m.pos.x + m.vel.x / 4.0
m.pos.y = m.pos.y + m.vel.y / 4.0
m.pos.z = m.pos.z + m.vel.z / 4.0
-- ESTELA MULTIDIMENSIONAL DE ENERGÍA
if gGlobalTimer % 2 == 0 then
spawn_object(m.marioObj, MODEL_SPARKLES, bhvSparkle)
if isCosmicActive then
-- Efecto hiper-velocidad: Estela de estrellas cósmicas y fuego azul
spawn_object(m.marioObj, MODEL_STAR, bhvCelebrationStar)
spawn_object(m.marioObj, MODEL_BLUE_FLAME, bhvFlameMario)
end
end
-- Ritmo de aleteo supersónico adaptado a la velocidad actual
if (gGlobalTimer % (isCosmicActive and 6 or 16) == 0) then
play_sound(SOUND_ACTION_FLYING_WING_CAP, m.marioObj.header.gfx.cameraToObject)
end
-- Forzar la animación nativa de vuelo de forma estable
set_mario_animation(m, MARIO_ANIM_WING_CAP_FLY)
return true -- Cancelar el bucle de físicas estándar de Nintendo para lograr fluidez absoluta
end
end)
-------------------------------------------------------------------------
-- 3. INTERCEPTOR Y RECTIFICACIÓN DEL NADO (AGUA INVERSA)
-------------------------------------------------------------------------
hook_event(HOOK_MARIO_UPDATE, function(m)
if m.playerIndex ~= 0 then return end
-- Garantizar que en el agua el eje Y funcione de forma idéntica y directa (Arriba = Superficie)
if (m.action & ACT_FLAG_SWIMMING) ~= 0 then
if m.controller.stickY ~= 0 then
local stickYNormalized = m.controller.stickY / 64.0
m.vel.y = stickYNormalized * SWIM_SPEED_VAL
m.faceAngle.pitch = math.floor(-stickYNormalized * 0x1800)
end
end
end)
To embed this project on your website, copy the following code and paste it into your website's HTML: