okay so for college I need to create an app, designing it was simple enough and getting all the graphics sorted, easy. I can create the scenes that I need so far, but “so far” is the first page and thats it…
Im struggling to link my “Scenes” I believe they are called? Ive been watching a tutorial that uses the Director Class (im using the condensed version http://developer.coronalabs.com/code/director-class-24-lines-code), but for the life of me I cant get it to move between scenes properly.
Where am I going wrong?! I just keep getting Nil Value errors
(screenshot of error message - http://gyazo.com/aa997339fac62210a3f38c05e93ff01a)
Ive removed some of the additional stuff I had set up but not moved onto yet in my code
main.lua
function changeScene(e)
if (e.phase == “ended”) then
director:changeScene(e.target.scene)
end
end
local director = require(“director”)
director:changeScene(“mainmenu”)
mainmenu.lua
module (…, package.seeall)
function new()
local menuGroup = display.newGroup()
local background = display.newImage(“images/menu_background.png”, 160, 240)
local menucircle = display.newImage(“images/menucircle.png”, 160, 240)
local options = display.newImage(“images/options_button.png”, 290, 40)
options.scene = “options”
options:addEventListener(“touch”, changeScene)
menuGroup:insert(background)
menuGroup:insert(menucircle)
menuGroup:insert(options)
return menuGroup
end
options.lua
module (…, package.seeall)
function new()
local optionsGroup = display.newGroup()
local background = display.newImage(“images/background.png”, 160, 240)
local menucircle = display.newImage(“images/menucircle.png”, 160, 240)
local home_button = display.newImage(“images/home_button.png”, 200, 30)
home_button.scene = “mainmenu”
home_button:addEventListener(“touch”, changeScene)
optionsGroup:insert(background)
optionsGroup:insert(menucircle)
optionsGroup:insert(home_button)
return optionsGroup
end