feat: 50 игр на Lua + импорт Roblox для всех + поддержка Lua в плеере #39
@ -802,22 +802,117 @@ end)`;
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
// ИГРА 11 — «Эхо» (нажми кнопку → звук)
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
'echo-room': {
|
||||
g11_main: `-- === ИГРА «ЭХО» (Lua) ===
|
||||
print("Касайся блоков — они отвечают звуком!")`,
|
||||
g11_block: `-- === Скрипт звукового блока (Lua) ===
|
||||
'echo-room': (function() {
|
||||
// Звуки и цвета для 6 плиток — должны совпадать с JS-builder
|
||||
const tiles = [
|
||||
{ sound: 'coin', color: '#e23b3b' }, // 1
|
||||
{ sound: 'jump', color: '#f59e0b' }, // 2
|
||||
{ sound: 'pickup', color: '#facc15' }, // 3
|
||||
{ sound: 'click', color: '#22c55e' }, // 4
|
||||
{ sound: 'hit', color: '#3b82f6' }, // 5
|
||||
{ sound: 'coin', color: '#a855f7' }, // 6
|
||||
];
|
||||
const TOTAL = tiles.length;
|
||||
|
||||
const overrides = {
|
||||
g11_main: `-- === ИГРА «ЭХО-КОМНАТА» — главный скрипт (Lua) ===
|
||||
${SNIPPET_BROADCAST}
|
||||
|
||||
local Players = game:GetService("Players")
|
||||
local player = Players.LocalPlayer
|
||||
local stepped = 0
|
||||
local TOTAL = ${TOTAL}
|
||||
local won = false
|
||||
|
||||
__rbxl_show_text("Наступи на все цветные плитки!", 3)
|
||||
|
||||
-- Счётчик в правом верхнем углу
|
||||
local screenGui = Instance.new("ScreenGui", player.PlayerGui)
|
||||
local label = Instance.new("TextLabel", screenGui)
|
||||
label.Size = UDim2.new(0, 240, 0, 50)
|
||||
label.Position = UDim2.new(1, -260, 0, 20)
|
||||
label.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
|
||||
label.BackgroundTransparency = 0.4
|
||||
label.TextColor3 = Color3.fromRGB(255, 255, 255)
|
||||
label.TextScaled = true
|
||||
label.Font = Enum.Font.SourceSansBold
|
||||
label.Text = "Плитки: 0 / " .. TOTAL
|
||||
|
||||
local winSound = Instance.new("Sound", workspace)
|
||||
winSound.SoundId = "win"; winSound.Volume = 1
|
||||
|
||||
-- Плитка впервые засчитана
|
||||
local stepEvent = getEvent("EchoStep")
|
||||
stepEvent.Event:Connect(function()
|
||||
stepped = stepped + 1
|
||||
label.Text = "Плитки: " .. stepped .. " / " .. TOTAL
|
||||
if stepped >= TOTAL then
|
||||
__rbxl_show_text("Все плитки звучали! Иди на финиш.", 3)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Игрок встал на финиш
|
||||
local finishEvent = getEvent("EchoFinish")
|
||||
finishEvent.Event:Connect(function()
|
||||
if won then return end
|
||||
if stepped < TOTAL then
|
||||
__rbxl_show_text("Сначала пройди все " .. TOTAL .. " плиток!", 2)
|
||||
return
|
||||
end
|
||||
won = true
|
||||
winSound:Play()
|
||||
__rbxl_show_text("Победа! Эхо-комната пройдена!", 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)`,
|
||||
g11_finish: `-- === Скрипт финиша (Lua) ===
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
local part = script.Parent
|
||||
local lastTouch = 0
|
||||
|
||||
part.Touched:Connect(function(hit)
|
||||
local now = tick()
|
||||
if now - lastTouch < 0.5 then return end
|
||||
lastTouch = now
|
||||
local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
|
||||
if not h then return end
|
||||
print("Блок " .. part.Name .. " звенит!")
|
||||
part.Color = Color3.fromRGB(math.random(0,255), math.random(0,255), math.random(0,255))
|
||||
local ev = ReplicatedStorage:FindFirstChild("EchoFinish")
|
||||
if ev then ev:Fire() end
|
||||
end)`,
|
||||
},
|
||||
};
|
||||
|
||||
// Скрипт каждой звуковой плитки — со своим звуком и цветом
|
||||
for (let i = 0; i < TOTAL; i++) {
|
||||
const t = tiles[i];
|
||||
overrides['g11_tile_' + (i + 1)] = `-- === Скрипт звуковой плитки (Lua) ===
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
local part = script.Parent
|
||||
local used = false
|
||||
local lastSound = 0
|
||||
|
||||
local tileSound = Instance.new("Sound", part)
|
||||
tileSound.SoundId = "${t.sound}"; tileSound.Volume = 0.8
|
||||
|
||||
part.Touched:Connect(function(hit)
|
||||
local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
|
||||
if not h then return end
|
||||
-- Звук эхом — каждый раз, но не чаще 0.4с
|
||||
local now = tick()
|
||||
if now - lastSound > 0.4 then
|
||||
lastSound = now
|
||||
tileSound:Play()
|
||||
-- Вспышка частиц над плиткой
|
||||
local pos = part.Position
|
||||
__rbxl_spawn_particles("sparks", pos.X, pos.Y + 1, pos.Z, 0.6, 1)
|
||||
end
|
||||
-- Засчитываем плитку только в первый раз
|
||||
if not used then
|
||||
used = true
|
||||
local ev = ReplicatedStorage:FindFirstChild("EchoStep")
|
||||
if ev then ev:Fire() end
|
||||
end
|
||||
end)`;
|
||||
}
|
||||
return overrides;
|
||||
})(),
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
// ИГРА 12 — «Кодовая дверь»
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user