spritesheet.lua file (Where to get it?)

Hello all I am trying to use a sprite sheet for some character animations. When I try to use it the console says it can't the lua file. I am a bit confused at how to get a spritesheet.lua from my spritesheet.png file I am using. I am extremely new to sprite sheets and any advise would be helpful.

Hey crazypsycho, you need to require sprite to use it:

local sprite = require("sprite")

You might want to read this too, which describes how Sprite API works:

http://developer.anscamobile.com/reference/sprite-sheets

Naomi

Thank you Naomi, I did that. The specific error I am getting is...

no field package.preload['swim_sheet']
no file 'C:\Users\Chris\Desktop\NCG\code\swim_sheet.lua'

Hey crazypsycho, do you use any tool to generate spritesheets? I use Spriteloq, and it automatically generates a lua file that accompanies the png file. If you don't use any tool, I think you need to generate your own sprite sheet descriptor file. I could be wrong, but the quick look at the reference link seems to suggest the need for it. Did you read the reference link?

http://developer.anscamobile.com/reference/sprite-sheets

Naomi

I will have to check with my artist. I doubt he got that file when he created it though or he would of sent it with the spritesheet. Do you know of any free tools that will generate both files like that?

Crazypsycho, once I started using Spriteloq, I haven't look for any other. So, I don't know how other ones work...

Naomi

Crazy,

I would recommend using Zwoptex. What I always do is make a series of PNG's, then putting them into Zwoptex (it's free). Then I export the sprite sheet as a .png and then add this code:

1
2
3
4
5
6
7
8
9
10
11
12
13
local loading = sprite.newSpriteSheet( "LoadingCircleOld.png", 102, 102 )
 
local spriteSet2 = sprite.newSpriteSet(loading, 1, 8)
sprite.add( spriteSet2, "LD", 1, 8, 200, 0 )
 
local loadingSprite = sprite.newSprite( spriteSet2 )
loadingSprite.x = _W/2; loadingSprite.y = _H/1.15
loadingSprite.xScale = .7; loadingSprite.yScale = .7
loadingSprite.alpha = .5
 
loadingSprite:prepare("LD")
loadingSprite:play()
loadingSprite:pause()   
views:1850 update:2011/11/17 9:28:17
corona forums © 2003-2011