feat(lua-games): полный паритет для игры 7 «Поймай падающее»
JS:
- ui.score, showText 'Лови падающие кубы! Нужно 15'
- every(1.5): random(x,z) → spawn cube y=14, anchored=false, deleteAfter 6с
- onPlayerTouch: caught[ref] флаг, +1 score, coin sound, при 15 — победа+confetti
Lua (паритет):
- ScreenGui+TextLabel 'Поймано: N / 15'
- task.spawn + task.wait(1.5) цикл спавна
- Instance.new('Part', workspace), Anchored=false (падение)
- Vector3.new для Position/Size
- Debris:AddItem(cube, 6) — авто-удаление
- cube.Touched: caught-флаг + score++ + coin Sound + Destroy
- При 15 — win Sound + showText + confetti
This commit is contained in:
parent
0603d922d4
commit
8021ed6a20
@ -482,36 +482,68 @@ end)`;
|
|||||||
// ИГРА 7 — «Ловишка предметов»
|
// ИГРА 7 — «Ловишка предметов»
|
||||||
// ═══════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════
|
||||||
'catch-falling': {
|
'catch-falling': {
|
||||||
g7_main: `-- === ИГРА «ЛОВИШКА ПРЕДМЕТОВ» — главный скрипт (Lua) ===
|
g7_main: `-- === ИГРА «ПОЙМАЙ ПАДАЮЩЕЕ» — главный скрипт (Lua) ===
|
||||||
|
local Players = game:GetService("Players")
|
||||||
local Debris = game:GetService("Debris")
|
local Debris = game:GetService("Debris")
|
||||||
|
|
||||||
|
local player = Players.LocalPlayer
|
||||||
local score = 0
|
local score = 0
|
||||||
local function showScore()
|
local GOAL = 15
|
||||||
print("Поймано: " .. score)
|
local won = false
|
||||||
end
|
|
||||||
showScore()
|
|
||||||
|
|
||||||
-- Каждую секунду создаём падающий предмет
|
__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()
|
task.spawn(function()
|
||||||
while true do
|
while not won do
|
||||||
task.wait(1)
|
task.wait(1.5)
|
||||||
local ball = Instance.new("Part")
|
if won then break end
|
||||||
ball.Shape = Enum.PartType.Ball
|
local cube = Instance.new("Part", workspace)
|
||||||
ball.Size = Vector3.new(1, 1, 1)
|
cube.Size = Vector3.new(0.8, 0.8, 0.8)
|
||||||
ball.Position = Vector3.new(math.random(-8, 8), 20, math.random(-8, 8))
|
cube.Position = Vector3.new(math.random(-6, 6), 14, math.random(-6, 6))
|
||||||
ball.Color = Color3.fromRGB(255, 215, 0)
|
cube.Color = Color3.fromRGB(255, 204, 51)
|
||||||
ball.Material = Enum.Material.Neon
|
cube.Material = Enum.Material.Neon
|
||||||
ball.Anchored = false
|
cube.Anchored = false -- падает под действием гравитации
|
||||||
ball.Parent = workspace
|
|
||||||
Debris:AddItem(ball, 10)
|
|
||||||
|
|
||||||
-- Скрипт на ловлю
|
-- Куб исчезает через 6с если не поймали
|
||||||
ball.Touched:Connect(function(hit)
|
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")
|
local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
|
||||||
if h and ball.Parent then
|
if not h then return end
|
||||||
score = score + 1
|
caught = true
|
||||||
showScore()
|
score = score + 1
|
||||||
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)
|
end)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user