Some animations attempt to use frame 0

I noticed that some of my animations set with the frames={3, 4, 60} style of the new API, try to use a frame 0.

This code:

{ name=“fly”, frames={1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 12, 11, 14, 15, 16, 17, 3, 2, 1}, loopCount = 1, loopDirection = “forward”, time = 22*animTime },
for example, return the following error:
WARNING: Sequence (fly) has an invalid index (0) that falls outside the range of valid image sheet indices: 1 <= index <= 17

[import]uid: 142895 topic_id: 26922 reply_id: 326922[/import]

I also get this error.

I’m using TexturePacker to create my textures.

I get the error on the “credits” sequence and not any of the rest.

[lua]local buttonSequence = {
{name = “playbutton”, frames = {18,17}},
{name = “credits”, frames = {2,1}},
{name = “blastButton”, frames = {14, 13}},
{name = “dashButton”, frames = {16, 15}},
{name = “easy”, frames = {5, 4}},
{name = “medium”, frames = {12, 11}},
{name = “hard”, frames = {8, 7}}
}[/lua]

I get no errors any where else except for credits [import]uid: 123298 topic_id: 26922 reply_id: 109380[/import]

@Axie Studios, that’s interesting. I wonder if the name “credits” is reserved word and that’s why it causes the error? Do you mind renaming it to something else (like “credit1”) and see if the problem persists?

Naomi [import]uid: 67217 topic_id: 26922 reply_id: 109388[/import]

I got a similar error when I tried something like the following (and I gave up on this particular method). I wondered if it was a bug or merely that it was not intended to be used this way.

Here’s a simplified example of what I tried to do. Say I have a very straight forward PNG file with 5 images of identical sizes (50x50). The PNG file is 100x150 with two squares (say, square1 & square2) on top row, two squares (square3 & square4) in the middle row and one square (square5) on the third row.

I wanted to play five different kinds of animation based on the same single PNG file with 5 different squares on it. And I thought I could create a sequenceData with 5 names to achieve this goal. But it didn’t work. It would be nice if we can do this, though:

local sequenceData = {  
 { name="anim1", start=1, count=5 },  
 { name="anim2", frames={ 2, 3, 4, 5, 1 } },  
 { name="anim3", frames={ 3, 2, 5, 1, 4 } },  
 { name="anim4", frames={ 4, 5, 1, 2, 3 } },  
 { name="anim5", frames={ 4, 1, 2, 5, 3 } },  
}  
local myAnim = {}  
for i=1,5 do  
 local anim = "anim" .. i  
 myAnim[i] = display.newSprite( imageSheet, sequenceData )  
 myAnim[i]:setSequence(anim)  
end  

Maybe the sequenceData cannot have more frames than what imageSheet has. So, with my example, if I want to have this work, would I need 25 squares on a sheet (even if it means I need 5 sets of same 5 images)…

Naomi

Edit: Just to make sure the code snippet mirror more closely to what I tried, I edited the frame sequence. [import]uid: 67217 topic_id: 26922 reply_id: 109277[/import]

Sure thing Naomi.

[lua]local buttonSequence = {
{name = “playbutton”, frames = {18,17}},
{name = “credit1”, frames = {2,1}},
{name = “blastButton”, frames = {14, 13}},
{name = “dashButton”, frames = {16, 15}},
{name = “easy”, frames = {5, 4}},
{name = “medium”, frames = {12, 11}},
{name = “hard”, frames = {8, 7}}
}[/lua]

WARNING: Sequence (credit1) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 26.

I still get the error on it.

Here’s more code if anyone wants to take a look:

[lua]local mainmenuAtlas = {}

–SheetInfo.sheet =
–{
mainmenuAtlas.frames = {

{ x=385, y=625, width=123, height=27 }, – credits_over@2x
{ x=385, y=598, width=123, height=27 }, – credits@2x
{ x=0, y=134, width=472, height=54 }, – difficulty@2x
{ x=365, y=734, width=96, height=37 }, – easy_over@2x
{ x=269, y=734, width=96, height=37 }, – easy@2x
{ x=217, y=363, width=37, height=38 }, – facebook@2x
{ x=0, y=731, width=112, height=39 }, – hard_over@2x
{ x=157, y=720, width=112, height=39 }, – hard@2x
{ x=215, y=631, width=170, height=33 }, – mainmenu_over@2x
{ x=215, y=598, width=170, height=33 }, – mainmenu@2x
{ x=330, y=674, width=157, height=38 }, – medium_over@2x
{ x=0, y=693, width=157, height=38 }, – medium@2x
{ x=0, y=230, width=217, height=203 }, – modeblast_over@2x
{ x=263, y=191, width=217, height=203 }, – modeblast@2x
{ x=0, y=433, width=215, height=204 }, – modedash_over@2x
{ x=254, y=394, width=215, height=204 }, – modedash@2x
{ x=165, y=664, width=165, height=56 }, – play_over@2x
{ x=0, y=637, width=165, height=56 }, – play@2x
{ x=0, y=188, width=263, height=42 }, – selectgame@2x
{ x=330, y=712, width=120, height=22 }, – sound_off@2x
{ x=385, y=652, width=120, height=22 }, – sound_on@2x
{ x=0, y=0, width=480, height=134 }, – title@2x
{ x=217, y=325, width=37, height=38 }, – trophy@2x
{ x=217, y=287, width=37, height=38 }, – twitter@2x
{ x=217, y=230, width=38, height=57 }, – htpbutton_over@2x
{ x=472, y=134, width=38, height=57 }, – htpbutton@2x
–},

}

mainmenuAtlas.sheetContentWidth = 510
mainmenuAtlas.sheetContentHeight = 771

return mainmenuAtlas[/lua]

I changed the TexturePacker lua file a bit to match the example on Mr. Beebe’s blog post.

I also have static images that I’m using form the same sheet and they all work fine. Kinda confused over here. [import]uid: 123298 topic_id: 26922 reply_id: 109389[/import]

There are one thing in common with all those problematic code.
They use frame number 1.

Let’s test, use other frames than 1… if it “fixed” the error, then we know what we can tell Ansca :slight_smile: [import]uid: 142895 topic_id: 26922 reply_id: 109392[/import]

Yup…tested and that got rid of the error.

Changed it to:
[lua]{name = “credit1”, frames = {2,3}},[/lua]

And I don’t get the error any more. Although, obviously I get the wrong roll-over image now.

Good find stan8 [import]uid: 123298 topic_id: 26922 reply_id: 109396[/import]

Changing my code to

{ name="fly", frames={2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 12, 11, 14, 15, 16, 17, 3, 2, 2}, loopCount = 1, loopDirection = "forward", time = 22\*animTime },

Also “fixed” the error (of course, the animation do not worked properly… but the error went away).

Having “1” in any place of the sequence, breaks it. [import]uid: 142895 topic_id: 26922 reply_id: 109406[/import]

Wow, thank you @stan8 & @Axie Studios for identifying the cause of the problem. I say it’s a bug that would be good to report. @stan8, will you? And include the URL of this thread so that Ansca team can refer to this?

Naomi [import]uid: 67217 topic_id: 26922 reply_id: 109413[/import]

Submitted this as a bug.

case #14641 [import]uid: 123298 topic_id: 26922 reply_id: 109564[/import]

Sounds great. Thanks, @Axie Studios! Hopefully, it will get fixed soon.

Naomi [import]uid: 67217 topic_id: 26922 reply_id: 109572[/import]

Hey, @stan8 & @Axie Studios, I just submitted a test project with this issue using the code on post #1 above. By the way, I forgot to include the link to this thread on the bug report – I realized it only a second after I clicked on submit button.

Anyhow, the small test project I created and tested on build 827 displayed lines of warning, but the sprite animations seem to play the way I’d expected them to play. So, maybe, even when there are warnings, it still works correctly? If not, do you have a test case where it displays the warning and causes the sprite animation not to work properly? If you do, you may want to submit it to bug report system.

Edit: Case 14647

Thanks,
Naomi
WARNING: Sequence (anim2) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim3) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim4) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim5) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim2) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim3) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim4) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim5) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim2) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim3) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim4) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim5) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim2) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim3) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim4) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim5) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim2) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim3) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim4) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5.
WARNING: Sequence (anim5) has an invalid index (0) that falls outside the range of valid image sheet frame indices: 1 <= index <= 5. [import]uid: 67217 topic_id: 26922 reply_id: 109607[/import]

I am investigating these bugs for you guys now, thanks for reporting [import]uid: 84637 topic_id: 26922 reply_id: 109658[/import]

Thank you, Danny!

Naomi [import]uid: 67217 topic_id: 26922 reply_id: 109727[/import]

Oh, the animation plays properly, the bug is only the erroneous warning. [import]uid: 142895 topic_id: 26922 reply_id: 109762[/import]

I’m getting the same error when playing sequence “walk”. Here’s my sequenceData Table:
[blockcode]
local moeSequenceData={
{name=“armedWalk”, start=7, count=10, time=650},
{name=“armedJumpUp”, start=1, count=1, time=100},
{name=“armedJumpDown”, start=2, count=5, time=350, loop=1},
{name=“death”, start=17, count=9, time=400, loop=1},
{name=“jumpUp”, start=26, count=1, time=100},
{name=“jumpDown”, start=27, count=5, time=350, loop=1},
{name=“walk”, start=32, count=10, time=650}
}
[/blockcode]

[blockcode]
WARNING: Sequence (walk) has an invalid count (10) that makes the last frame index of the sequence (41) fall outside the range of valid image sheet frame indices: 1 <= index <= 40.
done
[/blockcode]

What’s more, sequence “death” loops 3 times instead of just playing once, as stated in my sequenceData table. [import]uid: 105206 topic_id: 26922 reply_id: 110491[/import]