HELP! - Director class Error

Hello !!
I am currently developing an app which includes changing scenes…
I keep getting this error when I run it : Director ERROR: Module ‘credits’ must have a new ()function
the app contains 4 scenes, a startpage scene,a game scene, help scene and a credits scene.

**START PAGE.LUA*

module (…, package.seeall)

function new()
local startGroup = display.newGroup()

local background = display.newImage(“background.png”)

local Mybutton = display.newImage(“button.png”)
Mybutton.x = 190
Mybutton.y = 190
Mybutton.Scene = “game”

local button1 = display.newImage(“help.png”)
button1.x = 190
button1.y = 250
button1.Scene = “help”

local button2 = display.newImage(“credits.png”)
button2.x = 190
button2.y = 310
button2.Scene = “credits”

startGroup:insert(background)
startGroup:insert(Mybutton)
startGroup:insert(button1)
startGroup:insert(button2)

Mybutton:addEventListener(“touch”, changeScene)
button1:addEventListener(“touch”, changeScene)
button2:addEventListener(“touch”, changeScene)

return startGroup

end

*CREDITS.LUA*

module (…, package.seeall)

function new()
local gameGroup = display.newGroup()
print “THE CREDITS WILL GO HERE”
end

PLS HELP [import]uid: 202019 topic_id: 36475 reply_id: 336475[/import]

I’ve moved this to the Director forum.

Doesn’t Director need to have a return at the end of the new function?

[code]
module (…, package.seeall)

function new()
local gameGroup = display.newGroup()
print “THE CREDITS WILL GO HERE”

return gameGroup – add this line.
end
[/code] [import]uid: 199310 topic_id: 36475 reply_id: 144741[/import]

This is conflicting with the CoronaSDK credits.

http://docs.coronalabs.com/api/library/credits/index.html

Change the name of your Credits.lua to something else and the problem should go away. [import]uid: 67839 topic_id: 36475 reply_id: 144742[/import]

Thank you, now when i press the 'play button to bring the game scene it brings up brings the credit scene instead of the game scene :frowning: any ideas why? [import]uid: 202019 topic_id: 36475 reply_id: 144750[/import]

Thank you, now when i press the 'play button to bring the game scene it brings up brings the credit scene instead of the game scene :frowning: any ideas why? [import]uid: 202019 topic_id: 36475 reply_id: 144751[/import]

what does your changeScene function look like? [import]uid: 199310 topic_id: 36475 reply_id: 144757[/import]

You need to double check in your code where you call director:changeScene().

For example:
director:changeScene(“startgame”)

would go to startgame.lua [import]uid: 67839 topic_id: 36475 reply_id: 144758[/import]

something like this:

function changeScene(e)
if (e.phase == “ended”) then
director:changeScene(e.target.Scene)

end
end

local director = require(“director”)
local mainGroup = display.newGroup()
local function main()

mainGroup:insert(director.directorView)
director:changeScene(“startpage”)
return true;
end

main() [import]uid: 202019 topic_id: 36475 reply_id: 144781[/import]

something like this:

function changeScene(e)
if (e.phase == “ended”) then
director:changeScene(e.target.Scene)

end
end

local director = require(“director”)
local mainGroup = display.newGroup()
local function main()

mainGroup:insert(director.directorView)
director:changeScene(“startpage”)
return true;
end

main() [import]uid: 202019 topic_id: 36475 reply_id: 144782[/import]

where are you creating the button and setting its .Scene attribute? [import]uid: 199310 topic_id: 36475 reply_id: 144809[/import]

I’ve moved this to the Director forum.

Doesn’t Director need to have a return at the end of the new function?

[code]
module (…, package.seeall)

function new()
local gameGroup = display.newGroup()
print “THE CREDITS WILL GO HERE”

return gameGroup – add this line.
end
[/code] [import]uid: 199310 topic_id: 36475 reply_id: 144741[/import]

This is conflicting with the CoronaSDK credits.

http://docs.coronalabs.com/api/library/credits/index.html

Change the name of your Credits.lua to something else and the problem should go away. [import]uid: 67839 topic_id: 36475 reply_id: 144742[/import]

Thank you, now when i press the 'play button to bring the game scene it brings up brings the credit scene instead of the game scene :frowning: any ideas why? [import]uid: 202019 topic_id: 36475 reply_id: 144750[/import]

Thank you, now when i press the 'play button to bring the game scene it brings up brings the credit scene instead of the game scene :frowning: any ideas why? [import]uid: 202019 topic_id: 36475 reply_id: 144751[/import]

what does your changeScene function look like? [import]uid: 199310 topic_id: 36475 reply_id: 144757[/import]

You need to double check in your code where you call director:changeScene().

For example:
director:changeScene(“startgame”)

would go to startgame.lua [import]uid: 67839 topic_id: 36475 reply_id: 144758[/import]

something like this:

function changeScene(e)
if (e.phase == “ended”) then
director:changeScene(e.target.Scene)

end
end

local director = require(“director”)
local mainGroup = display.newGroup()
local function main()

mainGroup:insert(director.directorView)
director:changeScene(“startpage”)
return true;
end

main() [import]uid: 202019 topic_id: 36475 reply_id: 144781[/import]

something like this:

function changeScene(e)
if (e.phase == “ended”) then
director:changeScene(e.target.Scene)

end
end

local director = require(“director”)
local mainGroup = display.newGroup()
local function main()

mainGroup:insert(director.directorView)
director:changeScene(“startpage”)
return true;
end

main() [import]uid: 202019 topic_id: 36475 reply_id: 144782[/import]

where are you creating the button and setting its .Scene attribute? [import]uid: 199310 topic_id: 36475 reply_id: 144809[/import]

I’ve moved this to the Director forum.

Doesn’t Director need to have a return at the end of the new function?

[code]
module (…, package.seeall)

function new()
local gameGroup = display.newGroup()
print “THE CREDITS WILL GO HERE”

return gameGroup – add this line.
end
[/code] [import]uid: 199310 topic_id: 36475 reply_id: 144741[/import]