diff --git a/src/community/docsGamesBuildersLua.js b/src/community/docsGamesBuildersLua.js index 3248cec..2fcc493 100644 --- a/src/community/docsGamesBuildersLua.js +++ b/src/community/docsGamesBuildersLua.js @@ -3278,7 +3278,131 @@ end)`; })(), // ═══════════════════════════════════════════════════════════════ - // ИГРЫ 37-50: явных Lua-версий пока нет. + // ИГРА 37 — «Полоса препятствий» + // ═══════════════════════════════════════════════════════════════ + 'obstacle-course': (function() { + const SPIKE_IDS = [1, 2, 3, 4, 5, 6]; // id 1-6 — шипы + const overrides = { + g37_main: `-- === ИГРА «ПОЛОСА ПРЕПЯТСТВИЙ» — главный скрипт (Lua) === +${SNIPPET_BROADCAST} + +local TweenService = game:GetService("TweenService") +local Players = game:GetService("Players") +local RunService = game:GetService("RunService") +local player = Players.LocalPlayer +local won = false + +__rbxl_show_text("Пройди полосу: шипы, ямы, платформа!", 4) + +local loseSound = Instance.new("Sound", workspace) +loseSound.SoundId = "lose"; loseSound.Volume = 0.7 +local pickupSound = Instance.new("Sound", workspace) +pickupSound.SoundId = "pickup"; pickupSound.Volume = 0.7 +local winSound = Instance.new("Sound", workspace) +winSound.SoundId = "win"; winSound.Volume = 1 + +-- Движущаяся платформа: tween yoyo x: -0.5 ↔ 3, 2с +task.delay(0.2, function() + local mover = workspace:FindFirstChild("ДвижПлатформа") + if mover then + local mp = mover.Position + local startX = mp.X + local function loopMove() + local g1 = { Position = Vector3.new(3, mp.Y, mp.Z) } + local t1 = TweenService:Create(mover, TweenInfo.new(2), g1) + t1:Play() + t1.Completed:Connect(function() + local g2 = { Position = Vector3.new(startX, mp.Y, mp.Z) } + local t2 = TweenService:Create(mover, TweenInfo.new(2), g2) + t2:Play() + t2.Completed:Connect(loopMove) + end) + end + loopMove() + end +end) + +-- Респаун при падении +RunService.Heartbeat:Connect(function() + if won then return end + local py = __rbxl_player_y() + if py < -3 then + player:LoadCharacter() + loseSound:Play() + end +end) + +-- Чекпоинт — обновляем точку возрождения +local cpEvent = getEvent("CheckpointReached") +cpEvent.Event:Connect(function() + __rbxl_set_spawn(-0.5, 1, 24) + __rbxl_show_text("Чекпоинт сохранён!", 2) + pickupSound:Play() +end) + +-- Финиш +local winEvent = getEvent("FinishReached") +winEvent.Event:Connect(function() + if won then return end + won = true + __rbxl_show_text("Победа! Полоса пройдена!", 5) + winSound:Play() + 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)`, + g37_cp: `-- === Скрипт чекпоинта (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("CheckpointReached") + if ev then ev:Fire() end +end)`, + g37_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)`, + }; + // Шипы — Touched → damage 25 + hit + const spikeScript = `-- === Скрипт шипа (Lua) === +local part = script.Parent +local lastHit = 0 +local hitSound = Instance.new("Sound", part) +hitSound.SoundId = "hit"; hitSound.Volume = 0.6 + +part.Touched:Connect(function(hit) + local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid") + if not h then return end + local now = tick() + if now - lastHit < 0.5 then return end -- i-frames + lastHit = now + __rbxl_damage_player(25) + hitSound:Play() +end)`; + for (const sid of SPIKE_IDS) { + overrides['g37_spike_' + sid] = spikeScript; + } + return overrides; + })(), + + // ═══════════════════════════════════════════════════════════════ + // ИГРЫ 38-50: явных Lua-версий пока нет. // buildGameProject в docsGamesBuilders.js использует generateFallbackLua // (главный скрипт → показ подсказки + слушает FinishReached → // победа+конфетти; скрипт на финиш-примитиве → шлёт FinishReached; diff --git a/src/community/docsLessons.jsx b/src/community/docsLessons.jsx index 8bef888..e383220 100644 --- a/src/community/docsLessons.jsx +++ b/src/community/docsLessons.jsx @@ -5095,7 +5095,7 @@ game.onTick((dt) => { момент победы.

- {`// === ИГРА «ГОЛОВОЛОМКА С ЯЩИКАМИ» — главный скрипт === + {`// === ИГРА «ГОЛОВОЛОМКА С ЯЩИКАМИ» — главный скрипт === // для каждого ящика — на какой плите он сейчас (true/false) const onPlate = [false, false, false]; @@ -5119,7 +5119,7 @@ game.onMessage('box', (d) => { game.scene.spawnParticles('confetti', { x: p.x, y: p.y + 3, z: p.z }, { duration: 3, count: 3 }); } -});`} +});`}

Разберём: