Corona SDK removeSelf()滞后

时间:2016-03-04 17:41:32

标签: lua corona lag

我对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

有没有更好的方法来删除对象?

0 个答案:

没有答案