From eacc3f990b0ef5c4a25f33bf0410311571459b47 Mon Sep 17 00:00:00 2001 From: min Date: Tue, 9 Jun 2026 18:47:57 +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=2011=20=C2=AB?= =?UTF-8?q?=D0=AD=D1=85=D0=BE-=D0=BA=D0=BE=D0=BC=D0=BD=D0=B0=D1=82=D0=B0?= =?UTF-8?q?=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JS: - 6 цветных плиток-цилиндров со своими звуками - ui.score, ui.showText 'Наступи на все цветные плитки!' - onMessage 'step' → score++ + при 6 'Иди на финиш' - onMessage 'finish' → если < TOTAL то 'Сначала пройди все плитки' иначе showText + win + confetti - g11_tile_N: onTouch → sound + sparks particles, при первом — broadcast - g11_finish: onTouch → broadcast 'finish' Lua (паритет): - ScreenGui 'Плитки: N / 6' - BindableEvent EchoStep (плитка) + EchoFinish (зона) - 6 g11_tile_N: каждая со своим Sound (coin/jump/pickup/click/hit/coin) + __rbxl_spawn_particles('sparks', x, y+1, z) при касании + Throttle 0.4с между звуками + used-флаг - g11_main: 'Все плитки звучали! Иди на финиш' при 6 'Сначала пройди все 6 плиток!' если рано пришёл на финиш При win — Sound 'win' + confetti --- src/community/docsGamesBuildersLua.js | 117 +++++++++++++++++++++++--- 1 file changed, 106 insertions(+), 11 deletions(-) diff --git a/src/community/docsGamesBuildersLua.js b/src/community/docsGamesBuildersLua.js index 3856f82..7850d16 100644 --- a/src/community/docsGamesBuildersLua.js +++ b/src/community/docsGamesBuildersLua.js @@ -802,22 +802,117 @@ end)`; // ═══════════════════════════════════════════════════════════════ // ИГРА 11 — «Эхо» (нажми кнопку → звук) // ═══════════════════════════════════════════════════════════════ - 'echo-room': { - g11_main: `-- === ИГРА «ЭХО» (Lua) === -print("Касайся блоков — они отвечают звуком!")`, - g11_block: `-- === Скрипт звукового блока (Lua) === + 'echo-room': (function() { + // Звуки и цвета для 6 плиток — должны совпадать с JS-builder + const tiles = [ + { sound: 'coin', color: '#e23b3b' }, // 1 + { sound: 'jump', color: '#f59e0b' }, // 2 + { sound: 'pickup', color: '#facc15' }, // 3 + { sound: 'click', color: '#22c55e' }, // 4 + { sound: 'hit', color: '#3b82f6' }, // 5 + { sound: 'coin', color: '#a855f7' }, // 6 + ]; + const TOTAL = tiles.length; + + const overrides = { + g11_main: `-- === ИГРА «ЭХО-КОМНАТА» — главный скрипт (Lua) === +${SNIPPET_BROADCAST} + +local Players = game:GetService("Players") +local player = Players.LocalPlayer +local stepped = 0 +local TOTAL = ${TOTAL} +local won = false + +__rbxl_show_text("Наступи на все цветные плитки!", 3) + +-- Счётчик в правом верхнем углу +local screenGui = Instance.new("ScreenGui", player.PlayerGui) +local label = Instance.new("TextLabel", screenGui) +label.Size = UDim2.new(0, 240, 0, 50) +label.Position = UDim2.new(1, -260, 0, 20) +label.BackgroundColor3 = Color3.fromRGB(0, 0, 0) +label.BackgroundTransparency = 0.4 +label.TextColor3 = Color3.fromRGB(255, 255, 255) +label.TextScaled = true +label.Font = Enum.Font.SourceSansBold +label.Text = "Плитки: 0 / " .. TOTAL + +local winSound = Instance.new("Sound", workspace) +winSound.SoundId = "win"; winSound.Volume = 1 + +-- Плитка впервые засчитана +local stepEvent = getEvent("EchoStep") +stepEvent.Event:Connect(function() + stepped = stepped + 1 + label.Text = "Плитки: " .. stepped .. " / " .. TOTAL + if stepped >= TOTAL then + __rbxl_show_text("Все плитки звучали! Иди на финиш.", 3) + end +end) + +-- Игрок встал на финиш +local finishEvent = getEvent("EchoFinish") +finishEvent.Event:Connect(function() + if won then return end + if stepped < TOTAL then + __rbxl_show_text("Сначала пройди все " .. TOTAL .. " плиток!", 2) + 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)`, + g11_finish: `-- === Скрипт финиша (Lua) === +local ReplicatedStorage = game:GetService("ReplicatedStorage") local part = script.Parent -local lastTouch = 0 + part.Touched:Connect(function(hit) - local now = tick() - if now - lastTouch < 0.5 then return end - lastTouch = now local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid") if not h then return end - print("Блок " .. part.Name .. " звенит!") - part.Color = Color3.fromRGB(math.random(0,255), math.random(0,255), math.random(0,255)) + local ev = ReplicatedStorage:FindFirstChild("EchoFinish") + if ev then ev:Fire() end end)`, - }, + }; + + // Скрипт каждой звуковой плитки — со своим звуком и цветом + for (let i = 0; i < TOTAL; i++) { + const t = tiles[i]; + overrides['g11_tile_' + (i + 1)] = `-- === Скрипт звуковой плитки (Lua) === +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local part = script.Parent +local used = false +local lastSound = 0 + +local tileSound = Instance.new("Sound", part) +tileSound.SoundId = "${t.sound}"; tileSound.Volume = 0.8 + +part.Touched:Connect(function(hit) + local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid") + if not h then return end + -- Звук эхом — каждый раз, но не чаще 0.4с + local now = tick() + if now - lastSound > 0.4 then + lastSound = now + tileSound:Play() + -- Вспышка частиц над плиткой + local pos = part.Position + __rbxl_spawn_particles("sparks", pos.X, pos.Y + 1, pos.Z, 0.6, 1) + end + -- Засчитываем плитку только в первый раз + if not used then + used = true + local ev = ReplicatedStorage:FindFirstChild("EchoStep") + if ev then ev:Fire() end + end +end)`; + } + return overrides; + })(), // ═══════════════════════════════════════════════════════════════ // ИГРА 12 — «Кодовая дверь»