在Corona SDK中,为什么此函数返回错误?

时间:2014-10-21 01:42:10

标签: function lua corona

LINE 212   function onCollision(e)
  LINE 213     transition.to(gameView, {time = 300, x = -gameView.height,  display.remove() gameView= nil   



end})

   endGame = display.newImage('end_game_background.png', display.contentWidth, display.contentHeight-   300)


    transition.to(endGame)


background.isVisible = false
lineGroup.isVisible = false




end

当我尝试运行此代码时,我收到一条错误消息: main.lua line:213:'}'预计在gameView附近

1 个答案:

答案 0 :(得分:3)

transition.to(gameView, {time = 300, x = -gameView.height,  display.remove() gameView= nil 

end})

不正确,请尝试onCompleteonCancel,同时使用display.remove(gameView)代替display.remove()

transition.to(gameView, {time = 300, x = -gameView.height, onComplete=function() 
    display.remove(gameView)
    gameView= nil 
end})