Sprite Animation is so fast !

Hello World,

I started learning Corona yesterday and I am very noob here so please go easy on me!

I have a problem with animating a sprite sheet the animation works, but the animation speed is very very fast and I don’t know why it’s fast like this.

Can you please tell me what went wrong?

I am using the jungle-cat example and here’s my code:

local centerX = display.contentCenterX local centerY = display.contentCenterY local options = { width = 512, height = 256, numFrames = 8, sheetContentWidth = 2048, sheetContentHeight = 512 } local mySheet = graphics.newImageSheet("sprites-cat-running.png", options); local sequenceData = { {name = "normalRun", start = 1, count = 8, loopCount = 800}} local animation = display.newSprite(mySheet, sequenceData) animation.x = centerX animation.y = centerY animation:setSequence("normalRun") animation:play() animation = nil

time (optional)

Number. This is the time (in milliseconds) for the entire sequence to animate. If not specified, then the per-frame animation rate will be based on the frame rate of your app.

https://docs.coronalabs.com/api/library/display/newSprite.html#sequencedata-required

I honestly tried to play with this parameter and tried to set it on 1 and 1000000000 and it didn’t change the animation speed!

No worries, I believe you! :wink:

Try setting it to something more realistic like 1000 to 5000. It’s in milliseconds, so 1 would still be blazingly fast of course.

are you sure you are not confusing the ‘loopCount’ with the ‘time’ parameter thomas6 refers to… because loopCount 800 makes me think that you think that is ‘time’.

I could be wrong, but 800 for loop count seems out of the ordinary … add     time = 1000  

adding time parameter here just before loopCount

{name = “normalRun”, start = 1, count = 8,   time = 1000,   loopCount = 800}

I also tried that!

It’s weird and I am freaking out! because my code is very simple and should work perfectly, I have seen tutorials and their code looks exactly like mine!

Is the number of the frames in the sheet effects this ? does that mean that I have to have more frames in the picture? because I only have 8 frames.

OMG i copied cyberparkstudios’s code and it worked and i compared the 2 codes and found out that i’ve been writing times instead of time!!

I am realy sorry guys… please forgive me for the trouble!

most common mistakes, especially at first are

misspelling, typos, missing or wrong parameters

and…

scope

just my opinion.  keep at it, you will experience a lot more such oversights,… just don’t let it discourage you.  Corona forum is a good place to get help.

best of luck in your coding adventures.

Hey! Don’t worry about it at all! I think the last time I had a problem I sent about a hundred posts, before discovering it was just a wi-fi problem!

The forum’s here to help, and sometimes that means discovering a typo.

Keep it up!

Thanks, guys really!! you’re the best

time (optional)

Number. This is the time (in milliseconds) for the entire sequence to animate. If not specified, then the per-frame animation rate will be based on the frame rate of your app.

https://docs.coronalabs.com/api/library/display/newSprite.html#sequencedata-required

I honestly tried to play with this parameter and tried to set it on 1 and 1000000000 and it didn’t change the animation speed!

No worries, I believe you! :wink:

Try setting it to something more realistic like 1000 to 5000. It’s in milliseconds, so 1 would still be blazingly fast of course.

are you sure you are not confusing the ‘loopCount’ with the ‘time’ parameter thomas6 refers to… because loopCount 800 makes me think that you think that is ‘time’.

I could be wrong, but 800 for loop count seems out of the ordinary … add     time = 1000  

adding time parameter here just before loopCount

{name = “normalRun”, start = 1, count = 8,   time = 1000,   loopCount = 800}

I also tried that!

It’s weird and I am freaking out! because my code is very simple and should work perfectly, I have seen tutorials and their code looks exactly like mine!

Is the number of the frames in the sheet effects this ? does that mean that I have to have more frames in the picture? because I only have 8 frames.

OMG i copied cyberparkstudios’s code and it worked and i compared the 2 codes and found out that i’ve been writing times instead of time!!

I am realy sorry guys… please forgive me for the trouble!

most common mistakes, especially at first are

misspelling, typos, missing or wrong parameters

and…

scope

just my opinion.  keep at it, you will experience a lot more such oversights,… just don’t let it discourage you.  Corona forum is a good place to get help.

best of luck in your coding adventures.

Hey! Don’t worry about it at all! I think the last time I had a problem I sent about a hundred posts, before discovering it was just a wi-fi problem!

The forum’s here to help, and sometimes that means discovering a typo.

Keep it up!

Thanks, guys really!! you’re the best