diff --git a/src/community/docsGamesBuildersLua.js b/src/community/docsGamesBuildersLua.js index e478991..def8564 100644 --- a/src/community/docsGamesBuildersLua.js +++ b/src/community/docsGamesBuildersLua.js @@ -3024,7 +3024,108 @@ end)`, }, // ═══════════════════════════════════════════════════════════════ - // ИГРЫ 34-50: явных Lua-версий пока нет. + // ИГРА 34 — «Сбор урожая» + // ═══════════════════════════════════════════════════════════════ + 'harvest': (function() { + const PLANT_COUNT = 6; + const overrides = { + g34_main: `-- === ИГРА «СБОР УРОЖАЯ» — главный скрипт (Lua) === +${SNIPPET_BROADCAST} + +local GOAL = ${PLANT_COUNT} +local harvested = 0 + +__rbxl_score_set(0) +__rbxl_show_text("Дождись, пока растения вырастут, и собери!", 4) + +local coinSound = Instance.new("Sound", workspace) +coinSound.SoundId = "coin"; coinSound.Volume = 0.7 +local winSound = Instance.new("Sound", workspace) +winSound.SoundId = "win"; winSound.Volume = 1 + +local ev = getEvent("Harvested") +ev.Event:Connect(function() + harvested = harvested + 1 + __rbxl_score_set(harvested) + coinSound:Play() + if harvested >= GOAL then + __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 +end)`, + }; + // 6 растений — растут 5с (TweenService size+y), потом ripe, E собирает + const plantScript = `-- === Скрипт растения (Lua) === +local TweenService = game:GetService("TweenService") +local UserInputService = game:GetService("UserInputService") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local RunService = game:GetService("RunService") +local part = script.Parent + +local ripe = false +local picked = false +local hintVisible = false + +-- Растение растёт 5 секунд (size + y чтобы низ оставался на земле) +local goal = { + Size = Vector3.new(1.3, 2.6, 1.3), + Position = Vector3.new(part.Position.X, 2.3, part.Position.Z), +} +local tween = TweenService:Create(part, TweenInfo.new(5), goal) +tween:Play() +tween.Completed:Connect(function() + ripe = true + part.Color = Color3.fromRGB(255, 204, 51) -- спелое жёлтое +end) + +-- Подсказка [E] Собрать когда близко +RunService.Heartbeat:Connect(function() + if picked then return end + local px = __rbxl_player_x() + local pz = __rbxl_player_z() + local dx = part.Position.X - px + local dz = part.Position.Z - pz + local dist = math.sqrt(dx*dx + dz*dz) + local near = dist <= 3 + if near ~= hintVisible then + hintVisible = near + local hid = "g34_plant_" .. part.Name .. "_hint" + if near then + __rbxl_hud_set(hid, "[E] Собрать", 50, 75, "#ffe44a", 20) + else + __rbxl_hud_set(hid, nil) + end + end +end) + +UserInputService.InputBegan:Connect(function(input, gp) + if gp then return end + if not hintVisible then return end + if input.KeyCode ~= Enum.KeyCode.E then return end + if picked then return end + if not ripe then + __rbxl_show_text("Ещё не выросло! Подожди.", 1.5) + return + end + picked = true + -- Скрыть подсказку + __rbxl_hud_set("g34_plant_" .. part.Name .. "_hint", nil) + local ev = ReplicatedStorage:FindFirstChild("Harvested") + if ev then ev:Fire() end + part:Destroy() +end)`; + for (let i = 1; i <= PLANT_COUNT; i++) { + overrides['g34_plant_' + i] = plantScript; + } + return overrides; + })(), + + // ═══════════════════════════════════════════════════════════════ + // ИГРЫ 35-50: явных Lua-версий пока нет. // buildGameProject в docsGamesBuilders.js использует generateFallbackLua // (главный скрипт → показ подсказки + слушает FinishReached → // победа+конфетти; скрипт на финиш-примитиве → шлёт FinishReached; diff --git a/src/community/docsLessons.jsx b/src/community/docsLessons.jsx index 0172f8b..9844dd9 100644 --- a/src/community/docsLessons.jsx +++ b/src/community/docsLessons.jsx @@ -4664,7 +4664,7 @@ game.self.onTouch(() => {

Шаг 2. Главный скрипт

- {`// === ИГРА «ПЛАТФОРМЕР С БОССОМ» — главный скрипт === + {`// === ИГРА «ПЛАТФОРМЕР С БОССОМ» — главный скрипт === let won = false; let bossSpawned = false; @@ -4720,7 +4720,7 @@ game.onTick(() => { } }); } -});`} +});`}

Разберём по частям. Сначала — паркур: