Hi, I’ve recently started using corona and I came across the director class but I think I have done something wrong affiliated with it because the simulator is displaying a black screen when there shouldn’t be one.
Here is the code:
Main.lua:
local director = require(“director”)
display.setStatusBar(display.HiddenStatusBar)
local mainGroup = display.newGroup()
local function main()
mainGroup:insert(director.directorView)
director:changeScene(“menu”)
return true
end
main()
Menu.lua:
module(…, package.seeall)
function new()
local localGroup = display.newGroup()
local background = display.newImageRect(“graphics/background.psd”, _W, _H)
background:setReferencePoint(display.CenterReferencePoint)
background.x = _W/2
background.y = _H/2
local title = display.newImageRect(“graphics/poptitle.psd”, 300, 500)
title:setReferencePoint(display.CenterReferencePoint)
title.x = _W/2
title.y = 300
local playbutton = display.newImageRect(“graphics/play_b.psd”, 200, 300)
playbutton:setReferencePoint(display.CenterReferencePoint)
playbutton.x = _W/2
playbutton.y = 375
playbutton.scene = “game”
local levelsbutton = display.newImageRect(“graphics/levels_b.psd”, 200, 300)
levelsbutton:setReferencePoint(display.CenterReferencePoint)
levelsbutton.x = _W/2
levelsbutton.y = 320
levelsbutton.scene = “levels”
function changeScene(e)
if(e.phase == “ended”) then
director:changeScene(e.target.scene)
end
end
localGroup:insert(background)
localGroup:insert(title)
localGroup:insert(playbutton)
localGroup:insert(levelsbutton)
playbutton:addEventListener(“touch”, changeScene)
levelsbutton:addEventListener(“touch”, changeScene)
return localGroup
end
The game.lua and levels.lua files are the same as I haven’t edited either of them yet:
module(…, package.seeall)
function new()
local localGroup = display.newGroup()
return localGroup
end
Any help would be appreciated, thank you!