Cool. Glad to hear that the mystery is solved.
Naomi [import]uid: 67217 topic_id: 17066 reply_id: 64656[/import]
Cool. Glad to hear that the mystery is solved.
Naomi [import]uid: 67217 topic_id: 17066 reply_id: 64656[/import]
Well @Namoi, I would say the mystery has been worked around. Why is the filename credits.lua a problem? Was there a case issue? A hidden character in the filename? [import]uid: 19626 topic_id: 17066 reply_id: 64660[/import]
Well, I just renamed it back to credits.lua and it failed with the same error. So, I renamed it to credit.lua and that works.
Really strange. [import]uid: 10763 topic_id: 17066 reply_id: 64674[/import]
You might want to post this over in the Director forum and see if Ricardo has any insite. The word “credits” does not appear in director.lua (or any other thing in any of my director based projects. So I don’t have a clue why the name would pose a problem.
You’re not using credits anywhere else, or require’ing it somewhere in another module?
[import]uid: 19626 topic_id: 17066 reply_id: 64689[/import]
Hey guys, yes, it’s strange. @robmiracle, you’re right – it’s a work around. But then, so long as it works, perhaps, it’s okay.
Just for fun of it, I renamed level1.lua to credits.lua in my project, and sure enough, when loading credits.lua, it gives me the same error message.
I guess there are some file names we cannot use. The take away for me is, when all fails, try using different file name.
Naomi [import]uid: 67217 topic_id: 17066 reply_id: 64690[/import]
I had the exacts same issue with credits.lua. I had a credits_btn.png and a local variable named credits_var but I changed these and I still could not get the credits.lua to work, yet the rest of the game worked. Only after changing the credits.lua to something else was I able to get things to work properly. Btw I am very inexperienced with lua so I am not sure if it was some kind of scope issue so here is my old code:
–menu.lua
module(…, package.seeall);
–This method is required by director for each new screen
function new()
–Creates a local group
local localGroup = display.newGroup();
–Initialize the background
local bg = display.newImageRect(“images/trang.png”, _W, _H);
bg:setReferencePoint(display.CenterReferencePoint);
bg.x = _W/2; bg.y = _H/2+20;
–Initialize the title
local title = display.newImageRect(“images/dang.png”, _W-20,20);
title:setReferencePoint(display.CenterReferencePoint);
title.x = _W/2; title.y = _H-title.height*2+7;
–Initialize the play button
local play_vbr = display.newImageRect(“images/play_btn.png”, _W, 75);
play_vbr:setReferencePoint(display.CenterReferencePoint);
play_vbr.x = _W/2; play_vbr.y = _H/2 + play_vbr.height;
play_vbr.scene = “game”;
–Initialize the credits button
local credits_vrb = display.newImageRect(“images/credits_btn.png”, _W, 75);
credits_vrb:setReferencePoint(display.CenterReferencePoint);
credits_vrb.x = _W/2; credits_vrb.y = _H/2 + credits_vrb.height + credits_vrb.height;
credits_vrb.scene = “credits”;
–Function for changing the scene when the play or credits buttons are touched
function changeScene(e)
if(e.phase == “ended”)then
director:changeScene(e.target.scene);
end
end
–Inserts all images into the localGroup
localGroup:insert(bg);
localGroup:insert(play_vbr);
localGroup:insert(credits_vrb);
localGroup:insert(title);
–Event listener initialization for the play and credits buttons
play_vbr:addEventListener(“touch”, changeScene);
credits_vrb:addEventListener(“touch”, changeScene);
return localGroup;
end
–credits.lua
module(…, package.seeall)
function new()
–Create local group for the credit page
local localGroup = display.newGroup();
–Initialize image for the page
local img = display.newImageRect(“images/squirrel.png”, _W, _H);
img:setReferencePoint(display.CenterReferencePoint);
img.x = _W/2; img.y = _H/2;
img.scene = “menu”;
–Inserts image into local group
localGroup:insert(img);
–Function for changing the screen
function changeScene(e)
if(e.phase == “ended”)then
director:changeScene(e.target.scene);
end
end
–Event listener for touching the background image
img:addEventListener(“touch”, changeScene);
return localGroup;
end [import]uid: 105082 topic_id: 17066 reply_id: 69012[/import]
Guys,
You cannot use the name “credits” for a scene because there is an API called “credits”, just choose other name!
http://developer.anscamobile.com/content/creditsvirtual-currency [import]uid: 8556 topic_id: 17066 reply_id: 69017[/import]
Hey, Ricardo, thank you so much for tracking this down and letting us know!
Naomi [import]uid: 67217 topic_id: 17066 reply_id: 69020[/import]
Ricardo, thanks! I have since renamed the file and all is good! [import]uid: 10763 topic_id: 17066 reply_id: 69025[/import]
Thanks so much! [import]uid: 105082 topic_id: 17066 reply_id: 69248[/import]
change your “credits.lua” files name to something else. credits.lua is a main corona file and they conflict with one another [import]uid: 57002 topic_id: 17066 reply_id: 95200[/import]