Bad Sprite Transition

2 animations, each on their own PNG, combined into a SpriteMultiSet.

Anim1 loops.

Tap sprite to play Anim2.

First frame in, last frame out of Anim2 glitches.

New sprite sheet being prepared too soon?
My code error?

Anim2 alone is good.

[code]
local spriteSet2 = sprite.newSpriteMultiSet(
{
{ sheet = anim1Sheet, frames = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 } },
{ sheet = anim2Sheet, frames = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18 } }
}
)

sprite.add( spriteSet2, “anim1”, 1, 15, 1000, 0 )
sprite.add( spriteSet2, “anim2”, 16, 18, 1000, 1 )

local p1Hero = sprite.newSprite( spriteSet2 )
p1Hero:setReferencePoint(display.BottomCenterReferencePoint)
p1Hero.x = (270); p1Hero.y = (375);
p1Hero.xScale = (1.0); p1Hero.yScale = (1.0);

p1Hero:prepare( “anim1” )
p1Hero:play( “anim1” )

local function playanim2 (event)
p1Hero:prepare( “anim2” )
p1Hero:play( “anim2” )
end

local function returnToanim1 (event)
if event.phase == “end” then
p1Hero:prepare( “anim1” )
p1Hero:play( “anim1” )
end
end

p1Hero:addEventListener( “tap”, playanim2 )
p1Hero:addEventListener( “sprite”, returnToanim1 )
[/code] [import]uid: 45878 topic_id: 9604 reply_id: 309604[/import]

I would recommend using SpriteGrabber:
http://developer.anscamobile.com/code/spritegrabber-spritesheets-two-lines

It makes using multisets a lot easier to use.

-RD [import]uid: 7856 topic_id: 9604 reply_id: 35463[/import]

Does not fix problem. [import]uid: 45878 topic_id: 9604 reply_id: 46551[/import]

How does it glitch? Could it be a user error relating to the layout of your sprite sheet? [import]uid: 52491 topic_id: 9604 reply_id: 46619[/import]

Hi, did you resolve this issue? I am having similar problems as you had :frowning:

Joakim [import]uid: 81188 topic_id: 9604 reply_id: 57105[/import]

No, I wasn’t able to fix it.

Based on what I saw on the forums, it looked like the sprite functions were broken for something close to 10 months, so I gave up on Corona.

[import]uid: 45878 topic_id: 9604 reply_id: 57506[/import]

We have seen some timing problems with multiset sprites causing problem like this. The problem has been fixed by adding a one frame delay (33 msec) between the end of one sprite and the start of the next. You might try adding a timer.performWithDelay after the spriteInstance:prepare and the play() function. You can do this by embedding the play() function in the timer call. [import]uid: 7559 topic_id: 9604 reply_id: 58089[/import]