Sprite tearing when using newSpriteMultiSet with a 20 frame and a 9 frame sequence

Hi,

I have created a simple example of a bug I think I found when using newSpriteMultiSet with sheets of 20 and 9 frames. whenever I switch between 20 and 9 frame animation, theres a tearing of a few frames. howevet changing the delay between sequences in my example to above 1000ms eliminates the issue.

If I replace the 20 sheet animation with a 9 sheet one, the tearing goes away.

Is this me using animations via sprites incorrectly?

[lua]display.setStatusBar( display.HiddenStatusBar )

require(“sprite”)
local idleSESheet = sprite.newSpriteSheet( “skeleton_idle_southeast.png”, 128, 128 )
local walkSESheet = sprite.newSpriteSheet( “skeleton_walk_southeast.png”, 128, 128 )

local spriteSet = sprite.newSpriteMultiSet(
{
{ sheet = idleSESheet, frames = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 } },
{ sheet = walkSESheet, frames = { 1,2,3,4,5,6,7,8,9 } },
}
)

sprite.add(spriteSet, “idle-southeast”, 1, 20, 1000, 0)
sprite.add(spriteSet, “walk-southeast”, 21, 9, 1000, 0)

anim = sprite.newSprite( spriteSet )
anim.x = (200); anim.y = (300);
anim.x = 200
anim.y = 200

print(anim.sequence)

function switch()
if anim.sequence == “walk-southeast” then
anim:prepare( “idle-southeast” )
anim:play()
else
anim:prepare( “walk-southeast” )
anim:play()
end

end
– switching delay interval above 1000ms ( the animation time ) can sometimes eliminate the issue…
timer.performWithDelay( 1000, switch, 0)[/lua]
http://dl.dropbox.com/u/14594384/animation_bug.zip

Kegan [import]uid: 58115 topic_id: 10505 reply_id: 310505[/import]

It looks like you’ve found a bug with Corona Simulator.

I didn’t test it on the device but when complied that code works fine with the Xcode Simulator.

I think number of frames and/or defined durations (1000ms) being the same triggering the problem. [import]uid: 10478 topic_id: 10505 reply_id: 38630[/import]

Update on this:

If I crop my 20 frame sprite to the same size as the 9 frame sprite ( 384,384 ) the issue goes away.

Kegan [import]uid: 58115 topic_id: 10505 reply_id: 38718[/import]

Have you tried this with build 591? We fixed a few Sprite bugs. [import]uid: 7559 topic_id: 10505 reply_id: 48358[/import]

I’m also experiencing this issue. In the same set there is a 64 frame, a 32 frame and another 16 frame sheets and when transitioning from sheet to sheet there are visual “hickups” on the first and last frames of the second animation. That is, the first sheet (64) plays fine (character movement and death), but when transitioning to the other sheets (32 and 16 - character movement with two different hues), the first and last frames of the animation are wrong. This happens all the time and both in the simulator and on the devices. All the sheets have frames of the same size, but the duration of the animations varies quite a lot, which also means that the framerate isn’t always the same on all animations contained in these 3 files. [import]uid: 61899 topic_id: 10505 reply_id: 53415[/import]

Has anyone found a solution for this? I ran Kegan’s test program in 591 and 645 and it fails in each. [import]uid: 8468 topic_id: 10505 reply_id: 62719[/import]

It’s a known bug and no solution yet. If you have a subscription you can file a bug report as that will help raise the priority of this bug. [import]uid: 61899 topic_id: 10505 reply_id: 62829[/import]

There is a timing problem when switching sprite sets. Try adding a one FPS delay (33 ms) before starting the next sprite.

[code]
function switch()
if anim.sequence == “walk-southeast” then
anim:pause()
timer.performWithDelay( 33, function() anim:prepare( “idle-southeast” ); anim:play() end )
else
anim:pause()
timer.performWithDelay( 33, function() anim:prepare( “walk-southeast” ); anim:play() end )
end

end
[/code] [import]uid: 7559 topic_id: 10505 reply_id: 62852[/import]

Timing has no effect. There is a bug in multi sprite set that causes the first frame of animation to be missed on the second and on sprite sheet. [import]uid: 43795 topic_id: 10505 reply_id: 97226[/import]