我在使用 Corona SDK 方面有点新手,我的主菜单按钮有点问题。每当我按下按钮时,它都不会移动或改变视图;按钮只是在标题屏幕中消失。
module(..., package.seeall)
local ui = require ("ui")
local ui = require ("director")
local assetPath = "assets/"
local mainGroup = display.newGroup()
function new(params)
local titleScreen = display.newImageRect(assetPath .. "Law of Magic.jpg",
display.contentWidth, display.contentHeight)
titleScreen.x = display.contentWidth / 2
titleScreen.y = 265
mainGroup:insert(titleScreen)
director:changeScene("titleScreen")
local newgame = ui.newButton{ default = assetPath .. "new game.png",
onRelease = function(event) director:changeScene("New game") end,}
newgame.x = display.contentWidth / 2
newgame.y = 445
mainGroup:insert(newgame)
local continue = ui.newButton{ default = assetPath .. "continue.png",
onRelease = function(event) director:changeScene("Continue") end,}
continue.x = display.contentWidth / 2
continue.y = 447
mainGroup:insert(continue)
local option = ui.newButton{ default = assetPath .. "option.png",
onRelease = function(event) director:changeScene("Option") end,}
option.x = display.contentWidth / 2
option.y = 449
mainGroup:insert(option)
local help = ui.newButton{ default = assetPath .. "help.png",
onRelease = function(event) director:changeScene("Help") end,}
help.x = display.contentWidth / 2
help.y = 451
mainGroup:insert(help)
local exitgame = ui.newButton{ default = assetPath .. "exit game.png",
onRelease = function(event) director:changeScene("Exit game") end,}
exitgame.x = display.contentWidth / 2
exitgame.y = 453
mainGroup:insert(exitgame)
return mainGroup
end