Question About Sprites

Per the docs here

http://docs.coronalabs.com/api/library/graphics/newImageSheet.html

I was wondering if i want my sprite sheet to animate back and forth, for instance, frame 1,2,3,4,3,2, and so on, do I need ot use the complex method or can i use the simple one?

I would like to keep things as simple as possible for my app as a whole.

Please advise. Appreciated.

Have another question about the same link…

Per this;

baseDir (optional)

Constant. Specifies the base directory where filename is located. Options include system.ResourceDirectory, system.DocumentsDirectory, system.TemporaryDirectory and system.CachesDirectory. Default: system.ResourceDirectory

if my sprite sheet is on a folder called Sprites, am I correct in assuming the code would look like this —> “sprites/imagename.png”? Or no?

Hi @jgcthatsme,

I can answer both questions for you:

  1. you can use the simple animation method and set “loopDirection” to “bounce” to have it go back and forth. No need to use the specific “frames” declaration for that.

[lua]{ name=“player”, start=1, count=12, time=600, loopCount=0, loopDirection=“bounce” }[/lua]

  1. you’re correct: just use “sprites/imagename.png” to reference your sprites in a subdirectory.

Any other questions, just post here.

Thanks,

Brent

Thank you Brent. I’m practicing sprites today. I appreciate the post. B) 

Have another question about the same link…

Per this;

baseDir (optional)

Constant. Specifies the base directory where filename is located. Options include system.ResourceDirectory, system.DocumentsDirectory, system.TemporaryDirectory and system.CachesDirectory. Default: system.ResourceDirectory

if my sprite sheet is on a folder called Sprites, am I correct in assuming the code would look like this —> “sprites/imagename.png”? Or no?

Hi @jgcthatsme,

I can answer both questions for you:

  1. you can use the simple animation method and set “loopDirection” to “bounce” to have it go back and forth. No need to use the specific “frames” declaration for that.

[lua]{ name=“player”, start=1, count=12, time=600, loopCount=0, loopDirection=“bounce” }[/lua]

  1. you’re correct: just use “sprites/imagename.png” to reference your sprites in a subdirectory.

Any other questions, just post here.

Thanks,

Brent

Thank you Brent. I’m practicing sprites today. I appreciate the post. B)