play() doesn't start from the current frame!

Hi, I’m trying the new Sprite Object but I found a bug : after set manualy a frame, play() restarts the animation from the 1st index :

seq_data = {name=“seq1”, start=1, count=5, time=2500}
spr = display.newSprite(sheet_image, seq_data)

spr:setFrame(3)
spr:play() --should start from the third index but no… [import]uid: 107239 topic_id: 34442 reply_id: 334442[/import]

I’m pretty sure someone has told me about this bug before but you should definitely file this with Corona Labs yourself too so they know how important this is. (Not to make more work for bug managers :confused: )

It’s easy to understand why this happens (you’re setting a new sequence and playing it, so of course it starts from the beginning) but the ability to continue from current frame is critical for a lot of animation styles. [import]uid: 41884 topic_id: 34442 reply_id: 136898[/import]

I’m not setting a new sequence, only a new frame in the same sequence and the play method should start/continue from the current frame. If it was a new sequence, I would understand that behaviour which starts from the beginning, but here, I don’t see why. [import]uid: 107239 topic_id: 34442 reply_id: 136907[/import]

You’re right, though in that code example you don’t play the sequence first so it’s about the same as setting a new one. Either way, the sequence frame register is still at start (1) and not at the current frame. (Which is not intuitive nor helpful, I know)

Anyway as I said, a bug report is best to keep it on their immediate awareness track. [import]uid: 41884 topic_id: 34442 reply_id: 136911[/import]

I didn’t play the sequence at first because I supposed use the default one but like you said, a bug report is better is the best thing to do :slight_smile:
Thanks [import]uid: 107239 topic_id: 34442 reply_id: 136915[/import]

I’m pretty sure someone has told me about this bug before but you should definitely file this with Corona Labs yourself too so they know how important this is. (Not to make more work for bug managers :confused: )

It’s easy to understand why this happens (you’re setting a new sequence and playing it, so of course it starts from the beginning) but the ability to continue from current frame is critical for a lot of animation styles. [import]uid: 41884 topic_id: 34442 reply_id: 136898[/import]

I’m not setting a new sequence, only a new frame in the same sequence and the play method should start/continue from the current frame. If it was a new sequence, I would understand that behaviour which starts from the beginning, but here, I don’t see why. [import]uid: 107239 topic_id: 34442 reply_id: 136907[/import]

You’re right, though in that code example you don’t play the sequence first so it’s about the same as setting a new one. Either way, the sequence frame register is still at start (1) and not at the current frame. (Which is not intuitive nor helpful, I know)

Anyway as I said, a bug report is best to keep it on their immediate awareness track. [import]uid: 41884 topic_id: 34442 reply_id: 136911[/import]

I didn’t play the sequence at first because I supposed use the default one but like you said, a bug report is better is the best thing to do :slight_smile:
Thanks [import]uid: 107239 topic_id: 34442 reply_id: 136915[/import]

@waltsir: I’m currently having the same issue. I set a sequence and frame, then play, and the first frame of the sequence then flashes before the sequence jumps to the frame I had set. I created a sprite event listener, and it tells me that playback is beginning on the frame that I set with setFrame; however, the flash frame is obvious. From what I can tell, this is definitely a bug.

My code:

[lua]function propTreeCapsule.playAnim ()

        branchSprite:play()

        capsuleSprite:play()

        parachuteSprite:play()

end

function propTreeCapsule.setAnim (spriteSequence, playAnim, spriteFrame)

        if (spriteSequence ~= nil) then

            branchSprite:setSequence(spriteSequence)

            capsuleSprite:setSequence(spriteSequence)

            parachuteSprite:setSequence(spriteSequence)

        end

        if (spriteFrame ~= nil) then

            branchSprite:setFrame(spriteFrame)

            capsuleSprite:setFrame(spriteFrame)

            parachuteSprite:setFrame(spriteFrame)

        end

        if (playAnim ~= nil and playAnim == true) then

            propTreeCapsule.playAnim()

        end

end

function propTreeCapsule.release (stretchFrame)

        if (stretchFrame > 1) then

            local reverseStartFrame = 10 - stretchFrame

            propTreeCapsule.setAnim(“release”, true, reverseStartFrame)

        end

end[/lua]

I thought since my post (6 months ago) this bug would be corrected! That’s strange a so big bug still exist for a SDK specialized in 2D games!

Hi David,

Can you put this into a new project, and submit it as a bug report, or send it to me? It sounds like it might need to be bumped up in priority, as the previous report has lingered too long.

Thanks,

Brent

@Brent: Sure thing. I’m not familiar with Corona’s bug reporting system; would you just need the code in a simple project, or would you need assets along with it? Thanks!

  • David

Hi David,

A very basic sample project is generally required, including assets, but just enough to exhibit the issue. You certainly don’t need to bundle up a whole slew of assets for your app. You can even create a little test project with alternate assets, as long as it shows the issue in action.

Once you have that, please submit it here:

http://developer.coronalabs.com/content/bug-submission

Thanks,

Brent

If it’s not a bug because we consider play() always starts from the ‘start’ sequence (but why it jumps to the 3rd frame so?), it would be useful to have a parameter to the method like that: play(start_frame)

By the way it would be really better the following method: play(start_frame, end_frame, time_between_each_frame) because it’s really awful to create all the existing possible sequences before!

local sheetInfo = require("sheet") local myImageSheet = graphics.newImageSheet("sheet.png", sheetInfo:getSheet()) local spr = display.newSprite(myImageSheet, {name="seq1", start=1, count=5, time=5000}) spr.x,spr.y = 150, 150 spr:setFrame(3) spr:play() --BUG: doesn't start to play directly from 3rd frame but from the 1st, then jump to the 3rd

@waltsir: I’m currently having the same issue. I set a sequence and frame, then play, and the first frame of the sequence then flashes before the sequence jumps to the frame I had set. I created a sprite event listener, and it tells me that playback is beginning on the frame that I set with setFrame; however, the flash frame is obvious. From what I can tell, this is definitely a bug.

My code:

[lua]function propTreeCapsule.playAnim ()

        branchSprite:play()

        capsuleSprite:play()

        parachuteSprite:play()

end

function propTreeCapsule.setAnim (spriteSequence, playAnim, spriteFrame)

        if (spriteSequence ~= nil) then

            branchSprite:setSequence(spriteSequence)

            capsuleSprite:setSequence(spriteSequence)

            parachuteSprite:setSequence(spriteSequence)

        end

        if (spriteFrame ~= nil) then

            branchSprite:setFrame(spriteFrame)

            capsuleSprite:setFrame(spriteFrame)

            parachuteSprite:setFrame(spriteFrame)

        end

        if (playAnim ~= nil and playAnim == true) then

            propTreeCapsule.playAnim()

        end

end

function propTreeCapsule.release (stretchFrame)

        if (stretchFrame > 1) then

            local reverseStartFrame = 10 - stretchFrame

            propTreeCapsule.setAnim(“release”, true, reverseStartFrame)

        end

end[/lua]

I thought since my post (6 months ago) this bug would be corrected! That’s strange a so big bug still exist for a SDK specialized in 2D games!

Hi David,

Can you put this into a new project, and submit it as a bug report, or send it to me? It sounds like it might need to be bumped up in priority, as the previous report has lingered too long.

Thanks,

Brent

@Brent: Sure thing. I’m not familiar with Corona’s bug reporting system; would you just need the code in a simple project, or would you need assets along with it? Thanks!

  • David

Hi David,

A very basic sample project is generally required, including assets, but just enough to exhibit the issue. You certainly don’t need to bundle up a whole slew of assets for your app. You can even create a little test project with alternate assets, as long as it shows the issue in action.

Once you have that, please submit it here:

http://developer.coronalabs.com/content/bug-submission

Thanks,

Brent