【发布时间】:2014-06-21 20:41:06
【问题描述】:
我创建了一个手榴弹和地面接触爆炸的场景,共有 5 颗手榴弹可供玩家使用。问题是当投掷不止一颗手榴弹时,仅对最新手榴弹和前一颗手榴弹调用 removeself 函数不会立即被吹走。
if event.object1.myname=="ground" and event.object2.myname=="grenade2" then
local ex2=audio.play(bomb,{loops=0})
health1=health1-1
check()
health1_animation:setFrame(health1)
explosion_animation2=display.newSprite(explosion_sheet,explosion_sequence)
explosion_animation2.x=event.object2.x
explosion_animation2.y=event.object2.y
explosion_animation2:play()
end
timer.performWithDelay(300,function() explosion_animation2:removeSelf()
end,1)
【问题讨论】:
标签: timer lua listener collision-detection coronasdk