Lua Script Vault

Store. Inspect. Ship.

A cleaner interface for managing personal Lua scripts, editing code from mobile, and downloading ready-to-run files.

Max Game Crasher V1

В этом скрипте можно повесилится и поломать игру, игра чинится перезаходом

Author: Max_dev
-- Max Game Crasher V1 - ТЕКСТ И КНОПКИ СДВИНУТЫ ВПРАВО
local w = display.contentWidth
local h = display.contentHeight

local gg = display.newGroup()
local men = display.newGroup()

-- СОСТОЯНИЯ
local rotate_all = false
local reverse_mode = false
local disco_mode = false
local black_screen = false

-- КНОПКА open
local btn = display.newRoundedRect(gg, w - 90, 30, 100, 45, 12)
btn:setFillColor(0.3,0.3,0.4)
btn:setStrokeColor(0.7,0.5,0.9,1)
btn.strokeWidth = 2
local btnText = display.newText("open", btn.x, btn.y, native.systemFontBold, 18)
btnText:setFillColor(1,1,1)
gg:insert(btnText)

-- МЕНЮ (размеры не меняем)
local panelW = 560
local panelH = 500
local panel = display.newRoundedRect(men, display.contentCenterX, display.contentCenterY, panelW, panelH, 18)
panel:setFillColor(0.1,0.1,0.15,0.96)
panel:setStrokeColor(0.7,0.5,0.9,1)
panel.strokeWidth = 2

local title = display.newText("Max Game Crasher V1", panel.x, panel.y - panelH/2 + 35, native.systemFontBold, 24)
title:setFillColor(1,1,1)
men:insert(title)

local close = display.newText("×", panel.x + panelW/2 - 35, panel.y - panelH/2 + 35, native.systemFontBold, 36)
close:setFillColor(1,0.4,0.4)
men:insert(close)

local lineTop = display.newLine(panel.x - panelW/2 + 20, panel.y - panelH/2 + 55, panel.x + panelW/2 - 20, panel.y - panelH/2 + 55)
lineTop:setStrokeColor(0.7,0.5,0.9,0.5)
lineTop.strokeWidth = 1
men:insert(lineTop)

men.isVisible = false

-- ПЕРЕТАСКИВАНИЕ КНОПКИ
local btnDrag = false
local btnStartX, btnStartY
local function onBtnDrag(e)
    if e.phase == "began" then
        btnDrag = true
        btnStartX = e.x - gg.x
        btnStartY = e.y - gg.y
    elseif e.phase == "moved" and btnDrag then
        gg.x = e.x - btnStartX
        gg.y = e.y - btnStartY
    elseif e.phase == "ended" then
        btnDrag = false
    end
    return true
end
btn:addEventListener("touch", onBtnDrag)
btnText:addEventListener("touch", onBtnDrag)

-- ПЕРЕТАСКИВАНИЕ МЕНЮ
local menuDrag = false
local menuStartX, menuStartY
local function onMenuDrag(e)
    if e.phase == "began" then
        menuDrag = true
        menuStartX = e.x - men.x
        menuStartY = e.y - men.y
    elseif e.phase == "moved" and menuDrag then
        men.x = e.x - menuStartX
        men.y = e.y - menuStartY
    elseif e.phase == "ended" then
        menuDrag = false
    end
    return true
end
panel:addEventListener("touch", onMenuDrag)
title:addEventListener("touch", onMenuDrag)

local function toggleMenu()
    men.isVisible = not men.isVisible
    btnText.text = men.isVisible and "close" or "open"
end
btn:addEventListener("tap", toggleMenu)
btnText:addEventListener("tap", toggleMenu)
close:addEventListener("tap", toggleMenu)

-- ============ ФУНКЦИИ ============

-- 1. ROTATE ALL
local rotateFrame = nil
local function rotateAllUpdate()
    if not rotate_all then return end
    local stage = display.getCurrentStage()
    if not stage then return end
    local function rotateObj(obj)
        if obj and obj.rotation then
            obj.rotation = (obj.rotation or 0) + 5
        end
        if obj and obj.numChildren then
            for i = 1, obj.numChildren do
                rotateObj(obj[i])
            end
        end
    end
    rotateObj(stage)
end
local function toggleRotate()
    rotate_all = not rotate_all
    if rotate_all then
        if not rotateFrame then rotateFrame = Runtime:addEventListener("enterFrame", rotateAllUpdate) end
    else
        if rotateFrame then Runtime:removeEventListener("enterFrame", rotateFrame); rotateFrame = nil end
    end
end

-- 2. REVERSE MODE
local reverseFrame = nil
local function reverseUpdate()
    if not reverse_mode then return end
    local stage = display.getCurrentStage()
    if not stage then return end
    local function reverseObj(obj)
        if obj and obj.rotation then
            obj.rotation = (obj.rotation or 0) + 180
        end
        if obj and obj.xScale then
            obj.xScale = -1
            obj.yScale = -1
        end
        if obj and obj.numChildren then
            for i = 1, obj.numChildren do
                reverseObj(obj[i])
            end
        end
    end
    reverseObj(stage)
end
local function toggleReverse()
    reverse_mode = not reverse_mode
    if reverse_mode then
        if not reverseFrame then reverseFrame = Runtime:addEventListener("enterFrame", reverseUpdate) end
        reverseUpdate()
    else
        if reverseFrame then Runtime:removeEventListener("enterFrame", reverseFrame); reverseFrame = nil end
        local stage = display.getCurrentStage()
        if stage then
            local function fixObj(obj)
                if obj and obj.rotation then obj.rotation = 0 end
                if obj and obj.xScale then obj.xScale = 1; obj.yScale = 1 end
                if obj and obj.numChildren then
                    for i = 1, obj.numChildren do fixObj(obj[i]) end
                end
            end
            fixObj(stage)
        end
    end
end

-- 3. DISCO
local discoTimer = nil
local function discoUpdate()
    if not disco_mode then return end
    local stage = display.getCurrentStage()
    if not stage then return end
    local function randomColor(obj)
        if obj and obj.setFillColor then
            obj:setFillColor(math.random(), math.random(), math.random())
        end
        if obj and obj.numChildren then
            for i = 1, obj.numChildren do
                randomColor(obj[i])
            end
        end
    end
    randomColor(stage)
end
local function toggleDisco()
    disco_mode = not disco_mode
    if disco_mode then
        if discoTimer then timer.cancel(discoTimer) end
        discoTimer = timer.performWithDelay(1000, discoUpdate, 0)
        discoUpdate()
    else
        if discoTimer then timer.cancel(discoTimer); discoTimer = nil end
    end
end

-- 4. BLACK SCREEN
local blackRect = nil
local function updateBlackScreen()
    if black_screen then
        if not blackRect then
            blackRect = display.newRect(0, 0, display.contentWidth, display.contentHeight)
            blackRect.anchorX = 0
            blackRect.anchorY = 0
            blackRect:setFillColor(0,0,0)
            blackRect:toFront()
        else
            blackRect.width = display.contentWidth
            blackRect.height = display.contentHeight
            blackRect:toFront()
        end
    else
        if blackRect then
            blackRect:removeSelf()
            blackRect = nil
        end
    end
end
local function toggleBlackScreen()
    black_screen = not black_screen
    updateBlackScreen()
end
Runtime:addEventListener("orientation", function() updateBlackScreen() end)

-- ============ ЧЕКБОКСЫ (СДВИНУТЫ ВПРАВО) ============
local startY = panel.y - panelH/2 + 90
local function addCheckbox(name, getter, setter)
    local y = startY
    startY = y + 55
    -- текст правее (было -230, стало -140)
    local label = display.newText(name, panel.x - 140, y, native.systemFont, 18)
    label:setFillColor(1,1,1)
    men:insert(label)
    -- кнопка правее (было +190, стало +220)
    local box = display.newRoundedRect(men, panel.x + 220, y, 36, 36, 6)
    box:setFillColor(0.2,0.2,0.25)
    box:setStrokeColor(0.8,0.8,0.8,1)
    box.strokeWidth = 2
    local check = display.newLine(men, box.x - 12, box.y, box.x - 3, box.y + 9, box.x + 12, box.y - 9)
    check:setStrokeColor(0.2,0.9,0.4)
    check.strokeWidth = 5
    check.isVisible = getter()
    local function tap()
        setter()
        check.isVisible = getter()
    end
    box:addEventListener("tap", tap)
    check:addEventListener("tap", tap)
end

addCheckbox("Rotate All", function() return rotate_all end, toggleRotate)
addCheckbox("Reverse Mode", function() return reverse_mode end, toggleReverse)
addCheckbox("Disco", function() return disco_mode end, toggleDisco)
addCheckbox("Black Screen", function() return black_screen end, toggleBlackScreen)

print("=================================")
print("Max Game Crasher V1 - ТЕКСТ СДВИНУТ ВПРАВО")
print("Rotate All, Reverse Mode, Disco, Black Screen")
print("=================================")

Info

ID: 3
Created: 2026-04-04 18:44:54
Updated: 2026-04-04 18:44:54