diff --git a/src/community/docsGamesBuildersLua.js b/src/community/docsGamesBuildersLua.js index 916d94f..f00f2a3 100644 --- a/src/community/docsGamesBuildersLua.js +++ b/src/community/docsGamesBuildersLua.js @@ -3511,7 +3511,96 @@ end)`; })(), // ═══════════════════════════════════════════════════════════════ - // ИГРЫ 39-50: явных Lua-версий пока нет. + // ИГРА 39 — «Башня — стройка» + // ═══════════════════════════════════════════════════════════════ + 'tower-build': (function() { + const STEPS = 8; + const overrides = { + g39_main: `-- === ИГРА «БАШНЯ — СТРОЙКА» — главный скрипт (Lua) === +${SNIPPET_BROADCAST} + +local STEPS = ${STEPS} +local placed = 0 + +__rbxl_score_set(0) +__rbxl_show_text("Подходи к местам и ставь блоки (E) снизу вверх", 4) + +local clickSound = Instance.new("Sound", workspace) +clickSound.SoundId = "click"; clickSound.Volume = 0.6 +local winSound = Instance.new("Sound", workspace) +winSound.SoundId = "win"; winSound.Volume = 1 + +-- Места шлют BlockPlaced:Fire(n) +local ev = getEvent("BlockPlaced") +ev.Event:Connect(function(n) + if n ~= placed + 1 then + __rbxl_show_text("Сначала поставь блок ниже!", 1.5) + return + end + placed = placed + 1 + __rbxl_score_set(placed) + clickSound:Play() + if placed >= STEPS 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) + else + __rbxl_show_text("Блок " .. placed .. " из " .. STEPS, 1.5) + end +end)`, + }; + // 8 мест-призраков — E делает блок «реальным» + for (let i = 1; i <= STEPS; i++) { + overrides['g39_spot_' + i] = `-- === Скрипт места под блок ${i} (Lua) === +local UserInputService = game:GetService("UserInputService") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local RunService = game:GetService("RunService") +local part = script.Parent + +local built = false +local hintVisible = false + +RunService.Heartbeat:Connect(function() + if built 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 <= 4 + if near ~= hintVisible then + hintVisible = near + if near then + __rbxl_hud_set("g39_spot_${i}_hint", "[E] Поставить блок", 50, 75, "#ffe44a", 20) + else + __rbxl_hud_set("g39_spot_${i}_hint", nil) + end + end +end) + +UserInputService.InputBegan:Connect(function(input, gp) + if gp then return end + if not hintVisible then return end + if built then return end + if input.KeyCode ~= Enum.KeyCode.E then return end + built = true + -- Делаем блок «реальным»: твёрдым, непрозрачным, коричневым + part.CanCollide = true + part.Transparency = 0 + part.Color = Color3.fromRGB(181, 101, 29) + __rbxl_hud_set("g39_spot_${i}_hint", nil) + local ev = ReplicatedStorage:FindFirstChild("BlockPlaced") + if ev then ev:Fire(${i}) end +end)`; + } + return overrides; + })(), + + // ═══════════════════════════════════════════════════════════════ + // ИГРЫ 40-50: явных Lua-версий пока нет. // buildGameProject в docsGamesBuilders.js использует generateFallbackLua // (главный скрипт → показ подсказки + слушает FinishReached → // победа+конфетти; скрипт на финиш-примитиве → шлёт FinishReached; diff --git a/src/community/docsLessons.jsx b/src/community/docsLessons.jsx index e69d927..43c7134 100644 --- a/src/community/docsLessons.jsx +++ b/src/community/docsLessons.jsx @@ -5394,7 +5394,7 @@ game.self.onTouch(() => { верно ли игрок повторяет.
{`// === ИГРА «МУЗЫКАЛЬНАЯ ИГРА» — главный скрипт ===
+ {`// === ИГРА «МУЗЫКАЛЬНАЯ ИГРА» — главный скрипт ===
const SOUNDS = ['coin', 'jump', 'click', 'hit']; // плитки 1..4
// загаданная последовательность из 5 нот
@@ -5440,7 +5440,7 @@ game.onMessage('press', (d) => {
game.ui.showText('Ошибка! Слушай и пробуй снова.', 2);
game.sound.play('lose');
}
-});`}
+});`}
Разберём:
SEQ = [1, 3, 2, 4, 1] — загаданная мелодия:
@@ -5463,13 +5463,13 @@ game.onMessage('press', (d) => {
для остальных поменяй звук и число в press.
{`// === Скрипт ноты-плитки 1 ===
+ {`// === Скрипт ноты-плитки 1 ===
game.self.onInteract(() => {
game.sound.play('coin');
game.scene.spawnParticles('sparks', game.self.position,
{ duration: 0.4, color: '#e23b3b' });
game.broadcast('press', { n: 1 });
-}, { text: 'Сыграть ноту', distance: 3 });`}
+}, { text: 'Сыграть ноту', distance: 3 });`}
При нажатии E плитка играет свой звук, вспыхивает искрами и шлёт