我正在Corona sdk制作一个游戏,不同的球弹起并用焊接接头相互粘连。当我重置游戏玩法时,所有关节都被摧毁,然后所有的球被重新定位。以下是我的一些代码:
--stickJoints and balls are tables that contain all the weld joints and ball objects
resetTotal = function()
for i=1,#stickJoints do
stickJoints[i]:removeSelf()
stickJoints[i]=nil
end
for i=1,20 do
--this resets all balls and sets linear and angular velocity to 0
resetP(balls[i],1000+(i-1)*400,5000,0)
end
end
问题是,只要点击重置按钮,连接的球就会暂时相互作用。任何想法都有帮助。谢谢!
答案 0 :(得分:1)
我认为你最好的选择是
timer.performWithDelay
调用一个函数,该函数将在物理有机会破坏约束后重新定位球。