sprite sheet non-stop

Hi,

I have a sprite set instance running fine on the first time of calling it (instance1.play())
However, when i call it second time (using instance1.play() as well), the sprite animiation DO NOT stop.
Do you have any idea?

The sprite sheet setup is a normal one just like below…

local sheet = sprite.newSpriteSheet( “sample.png”,255,200)

local spriteSet = sprite.newSpriteSet(sheet, 1, 8)
sprite.add( spriteSet, “cat”, 1, 8, 1000, 0 ) – play 8 frames every 1000 ms

local instance1 = sprite.newSprite( spriteSet )
instance1.x = 2* display.contentWidth / 4 + 30
instance1.y = baseline - 5
instance1.xScale = .5
instance1.yScale = .5

instance1:prepare(“cat”)
instance1:play()

(some other tasks codes… )

instance1:play()
Thanks for help! [import]uid: 9927 topic_id: 10395 reply_id: 310395[/import]

first read this api

sprite.add( spriteSet, sequenceName, startFrame, frameCount, time, [loopParam])

why 0 at last ?

http://developer.anscamobile.com/reference/index/spriteadd

you can even pause the sprites

http://developer.anscamobile.com/reference/index/spriteinstancepause

also reset

http://developer.anscamobile.com/reference/index/spriteinstancecurrentframe

:slight_smile: [import]uid: 12482 topic_id: 10395 reply_id: 37884[/import]

ohhhh! sorry typo mistake, the line should read

sprite.add( spriteSet, “cat”, 1, 8, 1000, 1 )

the first play run fine. it stop.
instance1:play()

the second play start the animation but without stop…
instance1:play()

I think it should work fine, I miss anything here?
(If pause or reset the animation manually, then i cann’t control the animiation cycle… )

thanks a lot.! [import]uid: 9927 topic_id: 10395 reply_id: 38027[/import]

Same problem here, is it a bug or are we doing something wrong? oO [import]uid: 46142 topic_id: 10395 reply_id: 38061[/import]

I post the bug in the bug report section http://developer.anscamobile.com/forum/2011/05/26/sprite-loopcount-1-play-loop-second-call-play
If it’s really a bug then it will be more visible :stuck_out_tongue: [import]uid: 46142 topic_id: 10395 reply_id: 38271[/import]

spriteInstance:play(): “Play animation sequence, starting at the current frame. Does not reset looping. A call to spriteInstance:prepare() must be called before the sequence can be played.”

In other words, you must call prepare() before you call play() every time.

Also: it’s considered bad forum-etiquette to repost the same thing in multiple forums.
[import]uid: 6787 topic_id: 10395 reply_id: 39859[/import]

Oh ok my bad, i misunderstood the documentation i thought i had to call prepare just once before play.
Thanks for your reply, so it’s not a bug :stuck_out_tongue: [import]uid: 46142 topic_id: 10395 reply_id: 39936[/import]