0
我已經使用coronaSDK作曲家在我的應用程序中有場景。我有一個選項按鈕,可以進入選項場景。然而,當我把在選擇項目場景回去MAINMENU場景中的按鈕,它不工作電暈sdk作曲家不會回到以前的場景
mainMenu.lua
local composer = require("composer")
local scene = composer.newScene()
-- "scene:create()"
function scene:create(event)
local sceneGroup = self.view
local backgroundimg = display.newImage("image/mainBackground.png")
backgroundimg.x = display.contentWidth*0.5
backgroundimg.y = display.contentHeight*0.5
sceneGroup:insert(backgroundimg)
local function startListener(event)
composer.gotoScene("scene.play")
end
local start = display.newRect(65,99.5,161,161)
start.alpha = 0.01
start:addEventListener("tap", startListener)
local function leaderListener(event)
composer.gotoScene("scene.leaderboards")
end
local leader = display.newRect(208,227.5,147,147)
leader.alpha = 0.01
leader:addEventListener("tap", leaderListener)
local function optionsListener(event)
composer.gotoScene("scene.options")
end
local options = display.newRect(332,92.5,147,147)
options.alpha = 0.01
options:addEventListener("tap", optionsListener)
local function quitListener(event)
os.exit()
end
local quit = display.newRect(432,240.5,120,120)
quit.alpha = 0.01
quit:addEventListener("tap", quitListener)
end
-- "scene:show()"
function scene:show(event)
local sceneGroup = self.view
local phase = event.phase
if (phase == "will") then
elseif (phase == "did") then
end
end
-- "scene:hide()"
function scene:hide(event)
local sceneGroup = self.view
local phase = event.phase
if (phase == "will") then
elseif (phase == "did") then
end
end
-- "scene:destroy()"
function scene:destroy(event)
local sceneGroup = self.view
end
scene:addEventListener("create", scene)
scene:addEventListener("show", scene)
scene:addEventListener("hide", scene)
scene:addEventListener("destroy", scene)
return scene
options.lua
local composer = require("composer")
local scene = composer.newScene()
-- "scene:create()"
function scene:create(event)
local sceneGroup = self.view
local function startListener(event)
composer.gotoScene("scene.mainMenu")
end
local start = display.newRect(65,99.5,161,161)
start.alpha = 1
start:addEventListener("tap", startListener)
end
有沒有錯誤?什麼「不」工作? – 2015-03-31 17:27:20
@Frozire按鈕似乎並不工作。 – 2015-03-31 18:43:47