0
在我無止境的亞軍遊戲中,我試圖在離開屏幕時移除一個障礙物,然後在屏幕右側的一組共同創建一個新的障礙物。它適用於大部分。問題是,當我添加一個新的障礙時,它瞬間閃現爲0,0(即場景的左下角......)。 HALP!在Marmalade Quick SDK(Lua)中,爲什麼我的精靈在0,0閃爍之前移動到正確的共同點?
function updateObstacle()
if (obstacle) then
if(obstacle.x < -100) then
(obstacle):removeFromParent()
obstacle = nil
end
end
if (obstacle) then
(obstacle):translate(blockSpeed * -1, 0)
end
end
function newObstacle()
if (gameState == gameStates.gameStarted) then
if not (obstacle) then
createObstacle()
end
end
end