From d758fdfbe6d92d89d6cb5313ad5493296eb3034e Mon Sep 17 00:00:00 2001 From: min Date: Tue, 9 Jun 2026 23:07:25 +0300 Subject: [PATCH] =?UTF-8?q?docs(45)=20+=20feat(g46):=20=C2=AB=D0=9A=D0=BB?= =?UTF-8?q?=D0=B8=D0=BA=D0=B5=D1=80=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit g45 docs: CodeBoth g45_main. g46 паритет (заменил simpleClicker fallback): - GOAL=200, points/perClick/autoIncome - Heartbeat: каждую секунду points += autoIncome → checkWin - BindableEvents CubeClicked/BuyPower/BuyAuto - g46_cube: ClickDetector → CubeClicked:Fire + sparks - g46_up1/up2: Heartbeat distance(3) + '[E] Купить ...' + InputBegan E - buyPower: -20 + perClick+=2 - buyAuto: -40 + autoIncome+=3 --- src/community/docsGamesBuildersLua.js | 161 +++++++++++++++++++++++++- src/community/docsLessons.jsx | 4 +- 2 files changed, 162 insertions(+), 3 deletions(-) diff --git a/src/community/docsGamesBuildersLua.js b/src/community/docsGamesBuildersLua.js index f526c48..72de679 100644 --- a/src/community/docsGamesBuildersLua.js +++ b/src/community/docsGamesBuildersLua.js @@ -4350,7 +4350,166 @@ end)`, // остальные target-скрипты → красят примитив на касание). // Это даёт «хоть что-то рабочее» в любой игре до того как напишем // полноценный Lua-скрипт. Когда дописываем игру — добавляем сюда явный override. - 'clicker': { g46_main: simpleClicker() }, + 'clicker': { + g46_main: `-- === ИГРА «КЛИКЕР» — главный скрипт (Lua) === +${SNIPPET_BROADCAST} + +local RunService = game:GetService("RunService") +local GOAL = 200 +local points = 0 +local perClick = 1 +local autoIncome = 0 +local won = false + +__rbxl_score_set(0) +__rbxl_show_text("Кликай по жёлтому кубу! Цель: 200 очков", 4) + +local clickSound = Instance.new("Sound", workspace) +clickSound.SoundId = "click"; clickSound.Volume = 0.6 +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 + +local function checkWin() + if not won and points >= GOAL then + won = true + __rbxl_show_text("Победа! Накоплено 200 очков!", 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 + +-- Авто-доход каждую секунду +local autoTimer = 0 +RunService.Heartbeat:Connect(function(dt) + if won then return end + autoTimer = autoTimer + dt + if autoTimer < 1 then return end + autoTimer = 0 + if autoIncome > 0 then + points = points + autoIncome + __rbxl_score_set(points) + checkWin() + end +end) + +-- Клик по кубу +local clickEvent = getEvent("CubeClicked") +clickEvent.Event:Connect(function() + if won then return end + points = points + perClick + __rbxl_score_set(points) + clickSound:Play() + checkWin() +end) + +-- Покупка силы клика (20) +local powerEvent = getEvent("BuyPower") +powerEvent.Event:Connect(function() + if points < 20 then + __rbxl_show_text("Нужно 20 очков для улучшения!", 1.5) + return + end + points = points - 20 + perClick = perClick + 2 + __rbxl_score_set(points) + pickupSound:Play() + __rbxl_show_text("Сила клика: +" .. perClick .. " за клик", 2) +end) + +-- Покупка авто-дохода (40) +local autoEvent = getEvent("BuyAuto") +autoEvent.Event:Connect(function() + if points < 40 then + __rbxl_show_text("Нужно 40 очков для авто-дохода!", 1.5) + return + end + points = points - 40 + autoIncome = autoIncome + 3 + __rbxl_score_set(points) + pickupSound:Play() + __rbxl_show_text("Авто-доход: +" .. autoIncome .. " в секунду", 2) +end)`, + g46_cube: `-- === Скрипт куба-кликера (Lua) === +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local part = script.Parent + +-- ClickDetector делает куб кликабельным +local cd = Instance.new("ClickDetector") +cd.Parent = part + +cd.MouseClick:Connect(function() + __rbxl_spawn_particles("sparks", part.Position.X, part.Position.Y + 1, part.Position.Z, 0.3, 1) + local ev = ReplicatedStorage:FindFirstChild("CubeClicked") + if ev then ev:Fire() end +end)`, + g46_up1: `-- === Скрипт улучшения «сила клика» (20 очков) (Lua) === +local UserInputService = game:GetService("UserInputService") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local RunService = game:GetService("RunService") +local part = script.Parent +local hintVisible = false + +RunService.Heartbeat:Connect(function() + 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 + if near then + __rbxl_hud_set("g46_up1_hint", "[E] Купить +силу клика (20)", 50, 75, "#ffe44a", 20) + else + __rbxl_hud_set("g46_up1_hint", 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 + local ev = ReplicatedStorage:FindFirstChild("BuyPower") + if ev then ev:Fire() end +end)`, + g46_up2: `-- === Скрипт улучшения «авто-доход» (40 очков) (Lua) === +local UserInputService = game:GetService("UserInputService") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local RunService = game:GetService("RunService") +local part = script.Parent +local hintVisible = false + +RunService.Heartbeat:Connect(function() + 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 + if near then + __rbxl_hud_set("g46_up2_hint", "[E] Купить авто-доход (40)", 50, 75, "#ffe44a", 20) + else + __rbxl_hud_set("g46_up2_hint", 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 + local ev = ReplicatedStorage:FindFirstChild("BuyAuto") + if ev then ev:Fire() end +end)`, + }, }; // ══════════════════════════════════════════════════════════════════ diff --git a/src/community/docsLessons.jsx b/src/community/docsLessons.jsx index c04cc64..2bed13c 100644 --- a/src/community/docsLessons.jsx +++ b/src/community/docsLessons.jsx @@ -6515,7 +6515,7 @@ game.scene.spawn('user:3', {

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

- {`// === ИГРА «СТРЕЛЯЛКА-АРЕНА» — главный скрипт === + {`// === ИГРА «СТРЕЛЯЛКА-АРЕНА» — главный скрипт === let score = 0; const GOAL = 15; @@ -6577,7 +6577,7 @@ game.every(1.8, () => { } } }); -});`} +});`}

Разберём: