杠精爱动脑筋yz85
2小时前回复过
论:为什么这种无脑小饼干游戏这么火爆(非标题党)


问:
为什么这种踩键盘+1速度的小饼干游戏会这么火?
核心代码反推:
-- Chocokey.lua by "杠精爱动脑筋yz85"
--Put me under every ASMR key!Or it won't work.
--这个版本发出的声音和特效仅个人可见(客户端only),别人看不到
local TS = game:GetService("TweenService")
local RS = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local key = script.Parent
local player = Players.LocalPlayer
local clickSound = RS:FindFirstChild("Sound1")
if not clickSound then
clickSound = Instance.new("Sound")
clickSound.Name = "Sound1"
clickSound.Parent = RS
--占位符,确保不会因为没有找到声音对象报错
end
--支持按键变化的参数
local PRESS_DOWN_SIZE = Vector3.new(1, 0.25, 1)
local PRESS_DOWN_POS = Vector3.new(0, -0.4, 0)
local TWEEN_TIME = 0.06
local RETURN_TIME = 0.1
--防抖
local cooldown = false
local COOLDOWN_TIME = 0.2
local function onPress()
if cooldown then return end
cooldown = true
local soundClone = clickSound:Clone()
soundClone.Parent = player:FindFirstChild("PlayerGui") or workspace
soundClone:Play()
game:Debris:AddItem(soundClone, soundClone.TimeLength + 0.1)
local pressTween = TS:Create(
key,
TweenInfo.new(TWEEN_TIME, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{
Size = PRESS_DOWN_SIZE,
Position = key.Position + PRESS_DOWN_POS
}
)
pressTween:Play()
pressTween.Completed:Connect(function()
local returnTween = TS:Create(
key,
TweenInfo.new(RETURN_TIME, Enum.EasingStyle.Back, Enum.EasingDirection.Out),
{
Size = Vector3.new(1, 1, 1),
Position = key.Position - PRESS_DOWN_POS
}
)
returnTween:Play()
end)
task.wait(COOLDOWN_TIME)
cooldown = false
end
local function isPlayerCharacter(part)
local character = part.Parent
if not character then return false end
local humanoid = character:FindFirstChild("Humanoid")
if not humanoid then return false end
if Players:GetPlayerFromCharacter(character) == player then
return true
end
return false
end
key.Touched:Connect(function(hit)
if isPlayerCharacter(hit) then
onPress()
end
end)
(直接在Ourplay手写的代码,未经测试,不保证能够在真实的环境下运行良好)
你要是拿AI写成本更低,配一个简单的+1速度以及数据存储就是这游戏的原型......
Roblox现象级游戏就这水平?Forsaken和Evade等一众游戏表示不服...