hey, im trying to get an nice menu for my game, ut i have some prolems with composer.
thers the code - whats wrong? i cant find the issuse - the code is not changing the scenes…
display.setStatusBar(display.HiddenStatusBar)
screenW, screenH, halfW, halfH = display.contentWidth, display.contentHeight, display.contentWidth/2, display.contentHeight/2
_H = display.contentHeight;
_W = display.contentWidth;
centerX = display.contentCenterX
centerY = display.contentCenterY
local composer = require(“composer”)
local scene = composer.newScene()
local widget = require “widget”
sceneGroup = display.newGroup()
function scene:create( event )
local sceneGroup = self.view
end
function tscreenView()
local function onEndlessRelase()
composer:gotoScene( “endless”, “fade”, 500 )
return true
end
local function onChaptRelase()
composer:gotoScene( “endless”, “fade”, 500 )
return true
end
local function onCredbtnRelase()
composer:gotoScene( “creds”, “fade”, 500 )
return true
end
local endlessbtn = widget.newButton
{
defaultFile = “endlessbtn.png”,
label = “endlessbtn”,
onEvent = onEndlessRelase
}
endlessbtn.anchorX = 0.5
endlessbtn.anchorY = 0.5
endlessbtn.y = _H/2 + 50
endlessbtn.x = _W/2 - 55
sceneGroup:insert(endlessbtn)
local chapt = widget.newButton
{
defaultFile = “chaptbtn.png”,
label = “chapt”,
onEvent = onChaptRelase
}
chapt.anchorX = 0.5
chapt.anchorY = 0.5
chapt.y = _H/2 + 360
chapt.x = _W/2 - 5
sceneGroup:insert(chapt)
local credbtn = widget.newButton
{
defaultFile = “creditbtn.png”,
label = “credbtn”,
onEvent = onCredbtnRelase
}
credbtn.anchorX = 0.5
credbtn.anchorY = 0.5
credbtn.y = (_H/2)/0.5 -50
credbtn.x = _W/2
sceneGroup:insert(credbtn)
end
local ts = display.newImage(“factory.png”)
ts.anchorX = 0.5
ts.anchorY = 0.5
ts.x = _W/2
ts.y = _H/2
display.remove(factorybg)
ts.isVisible = true
sceneGroup:insert(ts)
factorybg = display.newImage(“tscreenbg.png”)
factorybg.anchorX = 0.5
factorybg.anchorY = 0.5
factorybg.x = _W/2
factorybg.y = _H/2
sceneGroup:insert(factorybg)
transition.from(factorybg, {delay=3000, time=200, x=-_W, onComplete=tscreenView});
function scene:enter(event)
local group = self.view
if(composer.getPrevious() ~= nil) then
composer.purgeScene(composer.getSceneName())
composer.removeScene(composer.getSceneName())
end
end
scene:addEventListener(“create”, scene)
scene:addEventListener(“enter”, scene)
return scene