feat(lua-games): полный паритет для игры 10 «Прыжок-пружина»
JS: - showText 'Прыгай по батутам всё выше!' - onTick: y<-3 → respawn + lose sound - onMessage 'win' → showText + win + confetti - g10_tramp_N: onTouch → player.boostJump(3.2) + jump sound - g10_finish: onTouch → broadcast 'win' Lua (паритет): - __rbxl_show_text подсказка + 'Победа!' - Heartbeat: __rbxl_player_y() < -3 → LoadCharacter + lose Sound - BindableEvent WinReached + g10_finish.Touched → ev:Fire - При win — confetti Добавил хелпер в shim: - __rbxl_boost_jump(strength) → send 'player.boostJump' 3.2 = втрое выше обычного прыжка g10_tramp_4/5/6: Touched → __rbxl_boost_jump(3.2) + jump Sound с защитой от зацикливания (минимум 0.5с между активациями).
This commit is contained in:
parent
4186b49be4
commit
50b08b81bc
@ -721,20 +721,83 @@ end)`,
|
|||||||
// ═══════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════
|
||||||
// ИГРА 10 — «Прыжки на пружинах»
|
// ИГРА 10 — «Прыжки на пружинах»
|
||||||
// ═══════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════
|
||||||
'spring-jump': {
|
'spring-jump': (function() {
|
||||||
g10_main: `-- === ИГРА «ПРЫЖКИ НА ПРУЖИНАХ» — главный скрипт (Lua) ===
|
const overrides = {
|
||||||
print("Прыгай с пружины на пружину до финиша!")`,
|
g10_main: `-- === ИГРА «ПРЫЖОК-ПРУЖИНА» — главный скрипт (Lua) ===
|
||||||
g10_spring: `-- === Скрипт пружины (Lua) ===
|
${SNIPPET_BROADCAST}
|
||||||
|
|
||||||
|
local Players = game:GetService("Players")
|
||||||
|
local RunService = game:GetService("RunService")
|
||||||
|
local player = Players.LocalPlayer
|
||||||
|
local won = false
|
||||||
|
|
||||||
|
__rbxl_show_text("Прыгай по батутам всё выше!", 3)
|
||||||
|
|
||||||
|
local loseSound = Instance.new("Sound", workspace)
|
||||||
|
loseSound.SoundId = "lose"; loseSound.Volume = 1
|
||||||
|
local winSound = Instance.new("Sound", workspace)
|
||||||
|
winSound.SoundId = "win"; winSound.Volume = 1
|
||||||
|
|
||||||
|
-- Каждый кадр проверяем: упал вниз — на старт
|
||||||
|
RunService.Heartbeat:Connect(function()
|
||||||
|
if won then return end
|
||||||
|
local py = __rbxl_player_y()
|
||||||
|
if py < -3 then
|
||||||
|
player:LoadCharacter()
|
||||||
|
loseSound:Play()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Финиш-зона шлёт BindableEvent
|
||||||
|
local winEvent = getEvent("WinReached")
|
||||||
|
winEvent.Event:Connect(function()
|
||||||
|
if won then 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)`,
|
||||||
|
g10_finish: `-- === Скрипт финиша (Lua) ===
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
local part = script.Parent
|
local part = script.Parent
|
||||||
|
local fired = false
|
||||||
|
|
||||||
|
part.Touched:Connect(function(hit)
|
||||||
|
if fired then return end
|
||||||
|
local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
|
||||||
|
if not h then return end
|
||||||
|
fired = true
|
||||||
|
local ev = ReplicatedStorage:FindFirstChild("WinReached")
|
||||||
|
if ev then ev:Fire() end
|
||||||
|
end)`,
|
||||||
|
};
|
||||||
|
// Скрипт каждого батута — одинаковый код
|
||||||
|
const trampScript = `-- === Скрипт батута (Lua) ===
|
||||||
|
-- Игрок встал на батут — мощный подброс вверх.
|
||||||
|
local part = script.Parent
|
||||||
|
local jumpSound = Instance.new("Sound", part)
|
||||||
|
jumpSound.SoundId = "jump"; jumpSound.Volume = 0.7
|
||||||
|
|
||||||
|
local lastBoost = 0
|
||||||
part.Touched:Connect(function(hit)
|
part.Touched:Connect(function(hit)
|
||||||
local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
|
local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
|
||||||
local hrp = hit.Parent and hit.Parent:FindFirstChild("HumanoidRootPart")
|
if not h then return end
|
||||||
if h and hrp then
|
-- Не зацикливаем подброс — минимум 0.5с между активациями
|
||||||
-- Подбрасываем игрока вверх
|
local now = tick()
|
||||||
hrp.Velocity = Vector3.new(hrp.Velocity.X, 80, hrp.Velocity.Z)
|
if now - lastBoost < 0.5 then return end
|
||||||
end
|
lastBoost = now
|
||||||
end)`,
|
__rbxl_boost_jump(3.2) -- 3.2 = втрое выше обычного прыжка
|
||||||
},
|
jumpSound:Play()
|
||||||
|
end)`;
|
||||||
|
// Батуты в JS-builder имеют id 4, 5, 6 (после трёх этажей)
|
||||||
|
for (const tid of [4, 5, 6]) {
|
||||||
|
overrides['g10_tramp_' + tid] = trampScript;
|
||||||
|
}
|
||||||
|
return overrides;
|
||||||
|
})(),
|
||||||
|
|
||||||
// ═══════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════
|
||||||
// ИГРА 11 — «Эхо» (нажми кнопку → звук)
|
// ИГРА 11 — «Эхо» (нажми кнопку → звук)
|
||||||
|
|||||||
@ -1816,6 +1816,11 @@ export function registerRobloxShim(lua, opts) {
|
|||||||
color: color || '#ffffff',
|
color: color || '#ffffff',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
// Подброс игрока — паритет с JS game.player.boostJump(strength).
|
||||||
|
// 1.0 = обычный прыжок, 3.0 = втрое выше, и т.д.
|
||||||
|
global.set('__rbxl_boost_jump', (strength) => {
|
||||||
|
send('player.boostJump', { strength: Number(strength) || 1 });
|
||||||
|
});
|
||||||
// Эффекты частиц (confetti, sparks и т.п.) — как game.scene.spawnParticles.
|
// Эффекты частиц (confetti, sparks и т.п.) — как game.scene.spawnParticles.
|
||||||
// BabylonScene._spawnParticleEffect ждёт payload.type и payload.position.
|
// BabylonScene._spawnParticleEffect ждёт payload.type и payload.position.
|
||||||
global.set('__rbxl_spawn_particles', (kind, x, y, z, duration, count) => {
|
global.set('__rbxl_spawn_particles', (kind, x, y, z, duration, count) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user