feat: 50 игр на Lua + импорт Roblox для всех + поддержка Lua в плеере #39
@ -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
|
||||
if not h then return end
|
||||
caught = true
|
||||
score = score + 1
|
||||
showScore()
|
||||
ball:Destroy()
|
||||
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user