diff --git a/src/community/docsGamesBuildersLua.js b/src/community/docsGamesBuildersLua.js index 95335a3..44438a3 100644 --- a/src/community/docsGamesBuildersLua.js +++ b/src/community/docsGamesBuildersLua.js @@ -2078,24 +2078,84 @@ end)`; // ═══════════════════════════════════════════════════════════════ // ИГРА 24 — «Падающий мост» // ═══════════════════════════════════════════════════════════════ - 'falling-bridge': { - g24_main: `-- === ИГРА «ПАДАЮЩИЙ МОСТ» (Lua) === -print("Беги по мосту — плиты падают!")`, - g24_plate: `-- === Скрипт падающей плиты (Lua) === + 'falling-bridge': (function() { + const TILES = 18; + const overrides = { + g24_main: `-- === ИГРА «ПАДАЮЩИЙ МОСТ» — главный скрипт (Lua) === +${SNIPPET_BROADCAST} + +local Players = game:GetService("Players") +local RunService = game:GetService("RunService") +local player = Players.LocalPlayer +local won = false + +__rbxl_show_text("Беги по мосту — доски рушатся!", 3) + +local loseSound = Instance.new("Sound", workspace) +loseSound.SoundId = "lose"; loseSound.Volume = 0.7 +local winSound = Instance.new("Sound", workspace) +winSound.SoundId = "win"; winSound.Volume = 1 + +-- Респаун при падении в пропасть +RunService.Heartbeat:Connect(function() + if won then return end + local py = __rbxl_player_y() + if py < -3 then + player:LoadCharacter() + __rbxl_show_text("Упал в пропасть! Снова.", 1.5) + loseSound:Play() + end +end) + +-- Финиш сообщает о победе +local winEvent = getEvent("WinReached") +winEvent.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)`, + g24_finish: `-- === Скрипт финиша (Lua) === +local ReplicatedStorage = game:GetService("ReplicatedStorage") local part = script.Parent -local fell = false +local fired = false + part.Touched:Connect(function(hit) - if fell then return end + if fired then return end local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid") if not h then return end - fell = true - task.delay(0.5, function() - part.Anchored = false - part.CanCollide = false - game:GetService("Debris"):AddItem(part, 3) - end) + fired = true + local ev = ReplicatedStorage:FindFirstChild("WinReached") + if ev then ev:Fire() end end)`, - }, + }; + // 18 досок — каждая при касании играет click и исчезает через 1с + const plankScript = `-- === Скрипт доски моста (Lua) === +local Debris = game:GetService("Debris") +local part = script.Parent +local cracking = false + +local clickSound = Instance.new("Sound", part) +clickSound.SoundId = "click"; clickSound.Volume = 0.5 + +part.Touched:Connect(function(hit) + if cracking then return end + local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid") + if not h then return end + cracking = true + clickSound:Play() + -- через 1 секунду доска пропадает + Debris:AddItem(part, 1) +end)`; + for (let i = 1; i <= TILES; i++) { + overrides['g24_plank_' + i] = plankScript; + } + return overrides; + })(), // ═══════════════════════════════════════════════════════════════ // ИГРА 25 — «Облёт камеры»