显示两个对象碰撞时的图像



我正在使用CI,希望在两个对象相互碰撞时显示一个图像,此时会显示一个特定的图像,并且该图像只应在发生共谋的很短时间内显示。

它看起来像是一个poof函数或类似的东西。但我不明白如何解决这个问题。

我将为您的问题提供一些示例代码。一个动画男孩与其他对象碰撞(coll1)。

animatedboy.collision=function(self,event)
if event.other.name == "coll1" then
    picture.isVisible=true
function updateTime()
       display.remove(picture) or picture.isVisible=false
end
timeTaken = timer.performWithDelay( 1000, updateTime, timerTicks )          
end

animatedboy:addEventListener( "collision", animatedboy )

最新更新