feat(lua-games): полный паритет для игры 3 «Не упади»

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', ...) над игроком
This commit is contained in:
min 2026-06-09 13:26:38 +03:00
parent f56e9417c9
commit 0ed2cbf376

View File

@ -196,36 +196,80 @@ end)`,
// ═══════════════════════════════════════════════════════════════
// ИГРА 3 — «Не упади» (платформа сужается)
// ═══════════════════════════════════════════════════════════════
'dont-fall': {
'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
if won then return end
local char = player.Character
if char then
if not char then return end
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()
if hrp and hrp.Position.Y < -3 then
player:LoadCharacter()
startTime = tick()
alive = true
end)
end
end
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 — «Кнопка и дверь»