Sprite Sheets not working

When I run my code from corona project manager, I get this:

“module ‘sprite’ not found:resource (sprite.lu) does not exist in archive
no field package.preload[‘sprite’]”

along with other errors regarding not being able to find the files needed for local sprite=require"sprite"
If I run my same code out of corona it works fine.

Please help!! [import]uid: 11632 topic_id: 4699 reply_id: 304699[/import]

I’ve run quite a few sprite-based projects in CPM so it’s something other than “sprite sheets don’t work.”

In the Ansca sample projects I’m seeing

require "sprite"

…and not…

local sprite = require "sprite"

Not sure if that would be the source of your problems, but it’s something to check out.

Also, not sure if it was just a copy/paste typo, but part of the error message you show:

resource (sprite.lu) does not exist

…makes it look as if it’s looking for a file called sprite.lu – should that be sprite.lua?

If none of those things makes a difference zip up the file and send it to me: j@jawhye.com

Jay
[import]uid: 9440 topic_id: 4699 reply_id: 14917[/import]

They work for me as well. Did you drag & drop all assets into CPM? [import]uid: 11904 topic_id: 4699 reply_id: 14928[/import]

Oh, ksan has a good point – CPM doesn’t look in your project folder on your drive – it only cares about the assets you’ve specified in the CPM project (which is by design, so you can have extra code, graphics, etc., and not worry about them getting mixed in with only the stuff you need to build your project).

Make sure all the files referenced in your code are added as assets in the CPM project.

Jay [import]uid: 9440 topic_id: 4699 reply_id: 14951[/import]

I just created a new project in corona, with a main.lua that only has this:

local sprite = require (“sprite”)
and I get the following:

Copyright © 2009-2010 A n s c a , I n c .
Version: 2.0.0
Build: 2010.9.16.148
The file sandbox for this project is located at the following folder:
(/Users/charlesaudler/Library/Application Support/Corona Simulator/43-FA205199E2670C33DBCA4AF7EE0DC98A)
Runtime error
…yiCznVGACEx2QTeG7ytk+++TI/TemporaryItems/43/main.lua:11: module ‘sprite’ not found:resource (sprite.lu) does not exist in archive
no field package.preload[‘sprite’]
no file ‘/private/var/folders/Tm/TmyiCznVGACEx2QTeG7ytk+++TI/TemporaryItems/43/sprite.lua’
no file ‘/Applications/Corona.243/CoronaSDK/Corona Simulator.app/Contents/Resources/sprite.lua’
no file ‘/Applications/Corona.243/CoronaSDK/Corona Simulator.app/Contents/Resources/sprite.blu’
stack traceback:
[C]: ?
[C]: in function ‘require’
…yiCznVGACEx2QTeG7ytk+++TI/TemporaryItems/43/main.lua:11: in main chunk
Runtime error: …yiCznVGACEx2QTeG7ytk+++TI/TemporaryItems/43/main.lua:11: module ‘sprite’ not found:resource (sprite.lu) does not exist in archive
no field package.preload[‘sprite’]
no file ‘/private/var/folders/Tm/TmyiCznVGACEx2QTeG7ytk+++TI/TemporaryItems/43/sprite.lua’
no file ‘/Applications/Corona.243/CoronaSDK/Corona Simulator.app/Contents/Resources/sprite.lua’
no file ‘/Applications/Corona.243/CoronaSDK/Corona Simulator.app/Contents/Resources/sprite.blu’
stack traceback:
[C]: ?
[C]: in function ‘require’
…yiCznVGACEx2QTeG7ytk+++TI/TemporaryItems/43/main.lua:11: in main chunk
[import]uid: 11632 topic_id: 4699 reply_id: 14971[/import]

Can you post your newly created project here? I can try to run it on my end and see what happens. [import]uid: 11904 topic_id: 4699 reply_id: 14972[/import]

Thanks for the help!

I just tried re-installing corona and then tried the project(s) and they work fine.

Maybe something became corrupt at some point. It’s just weird that it worked in corona terminal but not cpm.

Thanks again!! [import]uid: 11632 topic_id: 4699 reply_id: 14973[/import]

Glad to hear its allright. Have fun! [import]uid: 11904 topic_id: 4699 reply_id: 14974[/import]

Weird, but glad it works now! Thanks for the follow-up!

Jay
[import]uid: 9440 topic_id: 4699 reply_id: 14975[/import]

I could sure use help. Having a similar problem. New to Lua. I am trying to create a separate class file called “CreditsDlg.lua”. No matter what I do, the program chokes at this line:

require ("CreditsDlg.lua")  

Here’s what it says:

Copyright © 2009-2010 A n s c a , I n c .
Version: 2.0.0
Build: 2010.243
The file sandbox for this project is located at the following folder:
(/Users/user1/Library/Application Support/Corona Simulator/3-C53476FEA1D65A7C47F1F26AD09181DE)
Runtime error
…E+BWrGIG4WsMEgxZpXxFE+++TI/TemporaryItems/3/main.lua:4: module ‘CreditsDlg.lua’ not found:resource (CreditsDlg.lua.lu) does not exist in archive
no field package.preload[‘CreditsDlg.lua’]
no file ‘/private/var/folders/UE/UE+BWrGIG4WsMEgxZpXxFE+++TI/TemporaryItems/3/CreditsDlg.lua.lua’
no file ‘/Applications/Corona.243/Corona Simulator.app/Contents/Resources/CreditsDlg.lua.lua’
no file ‘/Applications/Corona.243/Corona Simulator.app/Contents/Resources/CreditsDlg.lua.blu’
no file ‘/Applications/Corona.243/Corona Simulator.app/Contents/Resources/CreditsDlg.blu’
stack traceback:
[C]: ?
[C]: in function ‘require’
…E+BWrGIG4WsMEgxZpXxFE+++TI/TemporaryItems/3/main.lua:4: in main chunk
Runtime error: …E+BWrGIG4WsMEgxZpXxFE+++TI/TemporaryItems/3/main.lua:4: module ‘CreditsDlg.lua’ not found:resource (CreditsDlg.lua.lu) does not exist in archive
no field package.preload[‘CreditsDlg.lua’]
no file ‘/private/var/folders/UE/UE+BWrGIG4WsMEgxZpXxFE+++TI/TemporaryItems/3/CreditsDlg.lua.lua’
no file ‘/Applications/Corona.243/Corona Simulator.app/Contents/Resources/CreditsDlg.lua.lua’
no file ‘/Applications/Corona.243/Corona Simulator.app/Contents/Resources/CreditsDlg.lua.blu’
no file ‘/Applicat
ions/Corona.243/Corona Simulator.app/Contents/Resources/CreditsDlg.blu’
stack traceback:
[C]: ?
[C]: in function ‘require’
…E+BWrGIG4WsMEgxZpXxFE+++TI/TemporaryItems/3/main.lua:4: in main chunk

I don’t understand why it is searching for “CreditsDlg.lua.lu” among other things. I reinstalled Corona just to see if that would do anything different. No luck.

Thanks for any insight on this. [import]uid: 10818 topic_id: 4699 reply_id: 15283[/import]

Try doing this:

[lua]require (“CreditsDlg”)[/lua]

Don’t include the .lua suffix and see what happens.

Jay [import]uid: 9440 topic_id: 4699 reply_id: 15300[/import]

Jay-

Thanks for the reply! I tried that before, but I was missing this line at the top of my class file:

module(..., package.seeall)

That, combined with removing the ‘.lua’ extension, did the trick. Thanks!

-Dune [import]uid: 10818 topic_id: 4699 reply_id: 15319[/import]

Just if somebody runs into this error again,

Now it is a REAL problem, because the sprite library is no more supported and included!!

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

This came with the update to Graphics 2.0 …

You now have to use display.newSprite()

Just if somebody runs into this error again,

Now it is a REAL problem, because the sprite library is no more supported and included!!

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

This came with the update to Graphics 2.0 …

You now have to use display.newSprite()