如何在 Corona SDK 中切换到另一个场景?

我在 Corona SDK 中有一个主场景(main.lua)。在该场景中,有一个按钮,当您单击该按钮时,应该会转换到另一个场景(home.lua)。我该怎么做?最好使用 composer。

点赞
用户7026995
用户7026995

文档的示例中修改后的版本

local composer = require("composer")
local scene = composer.newScene()
...

local object = display.newImage("ball.png")

local function onObjectTouch(event)
    if (event.phase == "began") then

    elseif (event.phase == "ended") then
        composer.gotoScene("home")
    end
    return true
end
object:addEventListener("touch", onObjectTouch)
2020-01-09 17:14:35