0
所以我只想让我的碰撞侦听器发射一次。我已经试过如果执行变量,但它不完全优雅。停止多次发射电晕碰撞事件
local function collideGround(self, event)
local obj = event.other
local phase = event.phase
if (phase == "began") then
if obj == ground then
print("Hit")
end
elseif (phase == "ended") then
end
return true
end
player.collision = collideGround
player:addEventListener("collision", player)
您能否更新您的问题以表明您的问题?这段代码是否可以工作,并且你正试图让它更优雅?代码没有以某种方式工作? – josliber
它确实有效,但我想让碰撞侦听器只触发一次,它目前正在多次触发 – Alurus