我对Corona有问题,每当我在属于组的项目上调用removeSelf()
时,每隔一个项目会冻结一秒钟,然后传送到应该在此之后的位置,每个帧调用一次函数
function moveObstacle()
for a = 1, obstacles.numChildren, 1 do
if obstacles[a] ~= nil then
obstacles[a].x = obstacles[a].x - 2
if obstacles[a].x < -50 then
obstacles[a]:removeSelf()
end
if obstacles[a].addedPoint == false then
if ball.x > obstacles[a].x then
obstacles[a].addedPoint = true
points = points + 1
pointsText.text = points
end
end
end
end
end
有没有更好的方法来删除对象?