From 0ed2cbf376a473a5419396d299d1e4ae6cd98b4b Mon Sep 17 00:00:00 2001 From: min Date: Tue, 9 Jun 2026 13:26:38 +0300 Subject: [PATCH] =?UTF-8?q?feat(lua-games):=20=D0=BF=D0=BE=D0=BB=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=BF=D0=B0=D1=80=D0=B8=D1=82=D0=B5=D1=82=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=B8=D0=B3=D1=80=D1=8B=203=20=C2=AB?= =?UTF-8?q?=D0=9D=D0=B5=20=D1=83=D0=BF=D0=B0=D0=B4=D0=B8=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JS-версия: - ui.showText('Беги вперёд! Плитки исчезают!', 3) - onTick: y<-3 → respawn + 'Упал! Снова.' + sound 'lose' - broadcast 'finish' → 'Победа! Ты добежал!' + sound 'win' + confetti - скрипт плитки: onTouch → sound 'click' + game.after(1.2, delete) - скрипт финиша: onTouch → broadcast 'finish' Lua-версия (паритет): - __rbxl_show_text(...) подсказка + 'Упал!' + 'Победа!' - BindableEvent FinishReached как канал между скриптами - g3_main: Heartbeat респаун при Y<-3 + lose/win Sound - 14 g3_tile_N: Touched → click Sound + Debris:AddItem(part, 1.2) - g3_finish: Touched → ev:Fire (через fired-флаг) - На финише: __rbxl_spawn_particles('confetti', ...) над игроком --- src/community/docsGamesBuildersLua.js | 88 ++++++++++++++++++++------- 1 file changed, 66 insertions(+), 22 deletions(-) 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 — «Кнопка и дверь»