Hello,
I recently started a app.
I chose to use director class for scene switching.
so far I have my main.lua and i want director class to switch right from that tp my home.lua wich is my home screen.
but when i launch the app i get a director error and a corona error of the following:
director.lua:1092 atempt to call method “inster” (a nill value)
and the director error is
Director ERROR: failed to execut new params on funtion “home”
Below I have my code for main.lua and home.lua.
If anyone can tell me where im going wrogn here that would be great.
I know there is a way to make this work i am just unaware of it.
PLEASE HELP ME OUT!
main.lua
local director = require(“director”);
local mainGroup = display.newGroup();
local function main()
mainGroup:insert(director.directorView);
director:changeScene(“home”);
return true;
end
main();
home.lua
local director = require (“director”);
module(…, package.seeall)
function new()
local localGroup = display.newGroup();
local backround = display.newImageRect(“backround.jpg”);
backround:setReferencePoint(display.CentreReferencePoint);
backround. x = 0
backround. y = 210
local text = display.newText(“Welcome!” , 85,05,nativesystemfont,35); local text = display.newText(“My level of knowledge is…” , 23,55,nativesystemfont,25);
local beginner_btn = display.newImageRect(“beginner.jpg”);
Beginner_btn: setReferencePoint(display.CentreReferencePoint);
Beginner_btn.x = 160;
Beginner_btn.y = 275;
Beginner_btn.scene = “bCat”;
function changeScene(e)
if(e.phase == “ended”) then
director:changeScene(e.target.scene);
end
end
localGroup:insert(backround);
localGroup:insert(beginner_btn);
Beginner_btn:addEventListener(“touch”, changeScene);
return localGroup
end