diff --git a/src/community/docsGamesBuildersLua.js b/src/community/docsGamesBuildersLua.js index 5c717cd..0dab273 100644 --- a/src/community/docsGamesBuildersLua.js +++ b/src/community/docsGamesBuildersLua.js @@ -3685,7 +3685,121 @@ task.delay(2, startWave)`, }, // ═══════════════════════════════════════════════════════════════ - // ИГРЫ 41-50: явных Lua-версий пока нет. + // ИГРА 41 — «Платформер-приключение» + // ═══════════════════════════════════════════════════════════════ + 'adventure-platformer': (function() { + // Монетки — id 10..14 (после 9 платформ) + const COIN_IDS = [10, 11, 12, 13, 14]; + const overrides = { + g41_main: `-- === ИГРА «ПЛАТФОРМЕР-ПРИКЛЮЧЕНИЕ» — главный скрипт (Lua) === +${SNIPPET_BROADCAST} + +local Players = game:GetService("Players") +local RunService = game:GetService("RunService") +local player = Players.LocalPlayer +local coins = 0 +local won = false + +__rbxl_score_set(0) +__rbxl_show_text("Доберись до сокровища! Собирай монетки", 4) + +local coinSound = Instance.new("Sound", workspace) +coinSound.SoundId = "coin"; coinSound.Volume = 0.7 +local pickupSound = Instance.new("Sound", workspace) +pickupSound.SoundId = "pickup"; pickupSound.Volume = 0.7 +local loseSound = Instance.new("Sound", workspace) +loseSound.SoundId = "lose"; loseSound.Volume = 0.7 +local winSound = Instance.new("Sound", workspace) +winSound.SoundId = "win"; winSound.Volume = 1 + +-- Респаун при падении +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 coinEvent = getEvent("CoinCollected") +coinEvent.Event:Connect(function() + coins = coins + 1 + __rbxl_score_set(coins) + coinSound:Play() +end) + +-- Чекпоинт +local cpEvent = getEvent("CheckpointReached") +cpEvent.Event:Connect(function() + __rbxl_set_spawn(-0.5, 7, 28) + __rbxl_show_text("Чекпоинт! Дальше — отсюда.", 2) + pickupSound:Play() +end) + +-- Сокровище = победа +local treasureEvent = getEvent("TreasureFound") +treasureEvent.Event:Connect(function() + if won then return end + won = true + __rbxl_show_text("Победа! Сокровище и " .. coins .. " монет!", 6) + 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)`, + g41_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)`, + g41_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("TreasureFound") + if ev then ev:Fire() end +end)`, + }; + // 5 монеток: Touched → CoinCollected:Fire + Destroy + const coinScript = `-- === Скрипт монетки (Lua) === +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local part = script.Parent +local taken = false + +part.Touched:Connect(function(hit) + if taken then return end + local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid") + if not h then return end + taken = true + local ev = ReplicatedStorage:FindFirstChild("CoinCollected") + if ev then ev:Fire() end + part:Destroy() +end)`; + for (const cid of COIN_IDS) { + overrides['g41_coin_' + cid] = coinScript; + } + return overrides; + })(), + + // ═══════════════════════════════════════════════════════════════ + // ИГРЫ 42-50: явных Lua-версий пока нет. // buildGameProject в docsGamesBuilders.js использует generateFallbackLua // (главный скрипт → показ подсказки + слушает FinishReached → // победа+конфетти; скрипт на финиш-примитиве → шлёт FinishReached; diff --git a/src/community/docsLessons.jsx b/src/community/docsLessons.jsx index 8ce5884..87bd020 100644 --- a/src/community/docsLessons.jsx +++ b/src/community/docsLessons.jsx @@ -5691,7 +5691,7 @@ game.self.onInteract(() => { и считает врагов.

- {`// === ИГРА «ВЫЖИВАНИЕ ОТ ВОЛН» — главный скрипт === + {`// === ИГРА «ВЫЖИВАНИЕ ОТ ВОЛН» — главный скрипт === const WAVES = 3; // всего волн let wave = 0; @@ -5748,7 +5748,7 @@ function startWave() { } } -game.after(2, startWave); // первая волна через 2 секунды`} +game.after(2, startWave); // первая волна через 2 секунды`}

Разберём: