feat(lua-games): полный паритет для игры 6 «Цветные плитки»
JS-версия: - 36 плиток 6×6, серые - ui.score = painted, ui.showText - onMessage 'paint' → score++ + pickup sound + при 36 победа+win+confetti - tile: onTouch → setColor зелёный + broadcast 'paint' Lua-версия: - ScreenGui+TextLabel 'Плитки: N / 36' счётчик - __rbxl_show_text подсказка + 'Победа!' - BindableEvent TilePainted - 36 g6_tile_N: Touched → part.Color=зелёный + ev:Fire (painted-флаг) - g6_main: painted++/label.Text/pickup Sound; при 36 — win+confetti
This commit is contained in:
parent
f7074f5cd7
commit
8eec59af53
@ -412,25 +412,71 @@ end)`,
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
// ИГРА 6 — «Угадай цвет»
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
'color-tiles': {
|
||||
g6_main: `-- === ИГРА «УГАДАЙ ЦВЕТ» — главный скрипт (Lua) ===
|
||||
'color-tiles': (function() {
|
||||
const overrides = {
|
||||
g6_main: `-- === ИГРА «ЦВЕТНЫЕ ПЛИТКИ» — главный скрипт (Lua) ===
|
||||
${SNIPPET_BROADCAST}
|
||||
|
||||
local colors = { "red", "green", "blue", "yellow" }
|
||||
local target = colors[math.random(1, #colors)]
|
||||
print("Встань на плитку цвета: " .. target)
|
||||
local Players = game:GetService("Players")
|
||||
local player = Players.LocalPlayer
|
||||
local painted = 0
|
||||
local TOTAL = 36
|
||||
local won = false
|
||||
|
||||
local ev = getEvent("TileStepped")
|
||||
ev.Event:Connect(function(color)
|
||||
if color == target then
|
||||
print("Верно! +1 очко")
|
||||
target = colors[math.random(1, #colors)]
|
||||
print("Теперь встань на: " .. target)
|
||||
else
|
||||
print("Неверно! Нужен " .. target)
|
||||
__rbxl_show_text("Наступи на все плитки!", 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(160, 255, 160)
|
||||
label.TextScaled = true
|
||||
label.Font = Enum.Font.SourceSansBold
|
||||
label.Text = "Плитки: 0 / " .. TOTAL
|
||||
|
||||
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 paintEvent = getEvent("TilePainted")
|
||||
paintEvent.Event:Connect(function()
|
||||
if won then return end
|
||||
painted = painted + 1
|
||||
label.Text = "Плитки: " .. painted .. " / " .. TOTAL
|
||||
pickupSound:Play()
|
||||
if painted >= TOTAL then
|
||||
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
|
||||
end)`,
|
||||
},
|
||||
};
|
||||
// Скрипт для каждой из 36 плиток — одинаковый код через генератор
|
||||
const tileScript = `-- === Скрипт цветной плитки (Lua) ===
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
local part = script.Parent
|
||||
local painted = false
|
||||
|
||||
part.Touched:Connect(function(hit)
|
||||
if painted then return end
|
||||
local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
|
||||
if not h then return end
|
||||
painted = true
|
||||
part.Color = Color3.fromRGB(51, 221, 85) -- ярко-зелёный
|
||||
local ev = ReplicatedStorage:FindFirstChild("TilePainted")
|
||||
if ev then ev:Fire() end
|
||||
end)`;
|
||||
for (let i = 1; i <= 36; i++) overrides['g6_tile_' + i] = tileScript;
|
||||
return overrides;
|
||||
})(),
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
// ИГРА 7 — «Ловишка предметов»
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user