feat(lua-games): полный паритет для игры 11 «Эхо-комната»

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
This commit is contained in:
min 2026-06-09 18:47:57 +03:00
parent 3be10c3cf7
commit eacc3f990b

View File

@ -802,22 +802,117 @@ end)`;
// ═══════════════════════════════════════════════════════════════ // ═══════════════════════════════════════════════════════════════
// ИГРА 11 — «Эхо» (нажми кнопку → звук) // ИГРА 11 — «Эхо» (нажми кнопку → звук)
// ═══════════════════════════════════════════════════════════════ // ═══════════════════════════════════════════════════════════════
'echo-room': { 'echo-room': (function() {
g11_main: `-- === ИГРА «ЭХО» (Lua) === // Звуки и цвета для 6 плиток — должны совпадать с JS-builder
print("Касайся блоков — они отвечают звуком!")`, const tiles = [
g11_block: `-- === Скрипт звукового блока (Lua) === { 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 part = script.Parent
local lastTouch = 0
part.Touched:Connect(function(hit) 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") local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
if not h then return end if not h then return end
print("Блок " .. part.Name .. " звенит!") local ev = ReplicatedStorage:FindFirstChild("EchoFinish")
part.Color = Color3.fromRGB(math.random(0,255), math.random(0,255), math.random(0,255)) if ev then ev:Fire() end
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 — «Кодовая дверь» // ИГРА 12 — «Кодовая дверь»