我希望在我过渡后立即移除子弹。这是我的代码:
local bullet
local function shootf (event)
bullet = display.newRect(w/2, h/2, 15, 15)
physics.addBody( bullet, "static")
transition.to( bullet, {time = speed, x = bulletX, y = bulletY})
print( "bullet shot" )
end
shoot:addEventListener("tap", shootf)
如何正确清除子弹?我尝试了几件事,但我不知道如何处理de remove功能。
答案 0 :(得分:2)
按如下方式更改transition.to
,然后运行应用:
transition.to( bullet, {time = speed,
x = bulletX,
y = bulletY,
onComplete=function() bullet:removeSelf() end end})
保持编码.............:)