From 8021ed6a2041e01b0484ede94eb91a73d5ad6c8c Mon Sep 17 00:00:00 2001 From: min Date: Tue, 9 Jun 2026 17:34:16 +0300 Subject: [PATCH] =?UTF-8?q?feat(lua-games):=20=D0=BF=D0=BE=D0=BB=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=BF=D0=B0=D1=80=D0=B8=D1=82=D0=B5=D1=82=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=B8=D0=B3=D1=80=D1=8B=207=20=C2=AB?= =?UTF-8?q?=D0=9F=D0=BE=D0=B9=D0=BC=D0=B0=D0=B9=20=D0=BF=D0=B0=D0=B4=D0=B0?= =?UTF-8?q?=D1=8E=D1=89=D0=B5=D0=B5=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JS: - ui.score, showText 'Лови падающие кубы! Нужно 15' - every(1.5): random(x,z) → spawn cube y=14, anchored=false, deleteAfter 6с - onPlayerTouch: caught[ref] флаг, +1 score, coin sound, при 15 — победа+confetti Lua (паритет): - ScreenGui+TextLabel 'Поймано: N / 15' - task.spawn + task.wait(1.5) цикл спавна - Instance.new('Part', workspace), Anchored=false (падение) - Vector3.new для Position/Size - Debris:AddItem(cube, 6) — авто-удаление - cube.Touched: caught-флаг + score++ + coin Sound + Destroy - При 15 — win Sound + showText + confetti --- src/community/docsGamesBuildersLua.js | 78 +++++++++++++++++++-------- 1 file changed, 55 insertions(+), 23 deletions(-) diff --git a/src/community/docsGamesBuildersLua.js b/src/community/docsGamesBuildersLua.js index 8fb01b4..a4d3662 100644 --- a/src/community/docsGamesBuildersLua.js +++ b/src/community/docsGamesBuildersLua.js @@ -482,36 +482,68 @@ end)`; // ИГРА 7 — «Ловишка предметов» // ═══════════════════════════════════════════════════════════════ 'catch-falling': { - g7_main: `-- === ИГРА «ЛОВИШКА ПРЕДМЕТОВ» — главный скрипт (Lua) === + g7_main: `-- === ИГРА «ПОЙМАЙ ПАДАЮЩЕЕ» — главный скрипт (Lua) === +local Players = game:GetService("Players") local Debris = game:GetService("Debris") +local player = Players.LocalPlayer local score = 0 -local function showScore() - print("Поймано: " .. score) -end -showScore() +local GOAL = 15 +local won = false --- Каждую секунду создаём падающий предмет +__rbxl_show_text("Лови падающие кубы! Нужно 15", 3) + +-- Счётчик в правом верхнем углу +local screenGui = Instance.new("ScreenGui", player.PlayerGui) +local label = Instance.new("TextLabel", screenGui) +label.Size = UDim2.new(0, 220, 0, 50) +label.Position = UDim2.new(1, -240, 0, 20) +label.BackgroundColor3 = Color3.fromRGB(0, 0, 0) +label.BackgroundTransparency = 0.4 +label.TextColor3 = Color3.fromRGB(255, 215, 0) +label.TextScaled = true +label.Font = Enum.Font.SourceSansBold +label.Text = "Поймано: 0 / " .. GOAL + +local coinSound = Instance.new("Sound", workspace) +coinSound.SoundId = "coin"; coinSound.Volume = 1 +local winSound = Instance.new("Sound", workspace) +winSound.SoundId = "win"; winSound.Volume = 1 + +-- Каждые 1.5 сек роняем куб task.spawn(function() - while true do - task.wait(1) - local ball = Instance.new("Part") - ball.Shape = Enum.PartType.Ball - ball.Size = Vector3.new(1, 1, 1) - ball.Position = Vector3.new(math.random(-8, 8), 20, math.random(-8, 8)) - ball.Color = Color3.fromRGB(255, 215, 0) - ball.Material = Enum.Material.Neon - ball.Anchored = false - ball.Parent = workspace - Debris:AddItem(ball, 10) + while not won do + task.wait(1.5) + if won then break end + local cube = Instance.new("Part", workspace) + cube.Size = Vector3.new(0.8, 0.8, 0.8) + cube.Position = Vector3.new(math.random(-6, 6), 14, math.random(-6, 6)) + cube.Color = Color3.fromRGB(255, 204, 51) + cube.Material = Enum.Material.Neon + cube.Anchored = false -- падает под действием гравитации - -- Скрипт на ловлю - ball.Touched:Connect(function(hit) + -- Куб исчезает через 6с если не поймали + Debris:AddItem(cube, 6) + + -- Ловля: при касании игроком +1 очко + local caught = false + cube.Touched:Connect(function(hit) + if caught or won then return end local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid") - if h and ball.Parent then - score = score + 1 - showScore() - ball:Destroy() + if not h then return end + caught = true + score = score + 1 + label.Text = "Поймано: " .. score .. " / " .. GOAL + coinSound:Play() + cube:Destroy() + if score >= GOAL then + won = true + winSound:Play() + __rbxl_show_text("Победа! Ты поймал 15 кубов!", 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 end) end