我对 addEventListener “touch”有疑问。当两个或更多对象位于附近并通过一次“触摸”激活时,只有一个对象会击中结束阶段。
我试过的:
function theBall(event)
local ball = event.target.id.id
if event.phase == "began" then
print("began")
display.getCurrentStage():setFocus(event.target)
end
if event.phase == "ended" or event.phase == "cancelled" then
print("ended")
display.getCurrentStage():setFocus(nil)
end
end
invisibleBall[ball]:addEventListener( "touch", theBall)
在模拟器输出中:
began
began
began
ended