diff --git a/src/community/docsGamesBuildersLua.js b/src/community/docsGamesBuildersLua.js index fdd0591..09347df 100644 --- a/src/community/docsGamesBuildersLua.js +++ b/src/community/docsGamesBuildersLua.js @@ -196,36 +196,80 @@ end)`, // ═══════════════════════════════════════════════════════════════ // ИГРА 3 — «Не упади» (платформа сужается) // ═══════════════════════════════════════════════════════════════ - 'dont-fall': { - g3_main: `-- === ИГРА «НЕ УПАДИ» — главный скрипт (Lua) === + 'dont-fall': (function() { + const overrides = { + g3_main: `-- === ИГРА «НЕ УПАДИ» — главный скрипт (Lua) === +${SNIPPET_BROADCAST} + local Players = game:GetService("Players") local RunService = game:GetService("RunService") +local player = Players.LocalPlayer +local won = false -print("Удержись на платформе как можно дольше!") +__rbxl_show_text("Беги вперёд! Плитки исчезают!", 3) -local startTime = tick() -local alive = true +local loseSound = Instance.new("Sound", workspace) +loseSound.SoundId = "lose"; loseSound.Volume = 1 +local winSound = Instance.new("Sound", workspace) +winSound.SoundId = "win"; winSound.Volume = 1 RunService.Heartbeat:Connect(function() - if not alive then return end - for _, player in ipairs(Players:GetPlayers()) do - local char = player.Character - if char then - local hrp = char:FindFirstChild("HumanoidRootPart") - if hrp and hrp.Position.Y < -5 then - alive = false - local elapsed = math.floor(tick() - startTime) - print("Ты упал! Продержался: " .. elapsed .. " сек") - task.delay(2, function() - player:LoadCharacter() - startTime = tick() - alive = true - end) - end - end + if won then return end + local char = player.Character + if not char then return end + local hrp = char:FindFirstChild("HumanoidRootPart") + if hrp and hrp.Position.Y < -3 then + player:LoadCharacter() + loseSound:Play() + __rbxl_show_text("Упал! Снова.", 1.5) end +end) + +local finishEvent = getEvent("FinishReached") +finishEvent.Event:Connect(function() + if won then return end + won = true + winSound:Play() + __rbxl_show_text("Победа! Ты добежал!", 5) + local px = __rbxl_player_x() + local py = __rbxl_player_y() + local pz = __rbxl_player_z() + __rbxl_spawn_particles("confetti", px, py + 3, pz, 3, 3) end)`, - }, + g3_finish: `-- === Скрипт финиш-зоны (Lua) === +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local part = script.Parent +local fired = false + +part.Touched:Connect(function(hit) + if fired then return end + local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid") + if not h then return end + fired = true + local ev = ReplicatedStorage:FindFirstChild("FinishReached") + if ev then ev:Fire() end +end)`, + }; + // Скрипт каждой плитки — генератор (одинаковый код) + const tileScript = `-- === Скрипт исчезающей плитки (Lua) === +local Debris = game:GetService("Debris") +local part = script.Parent +local triggered = false +local clickSound = Instance.new("Sound", part) +clickSound.SoundId = "click"; clickSound.Volume = 0.6 + +part.Touched:Connect(function(hit) + if triggered then return end + local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid") + if not h then return end + triggered = true + clickSound:Play() + -- через 1.2с плитка пропадает + Debris:AddItem(part, 1.2) +end)`; + for (let i = 1; i <= 14; i++) overrides['g3_tile_' + i] = tileScript; + return overrides; + })(), // ═══════════════════════════════════════════════════════════════ // ИГРА 4 — «Кнопка и дверь»