Animation Looping With Loops Set to '0'

Hi, all-- I have an animation that is looping even though I have looping turned off for it.

Image sheet/sequence config:

local options =

{

  width = 128,

  height = 128,

  numFrames = 40

}

sheetExplosion = graphics.newImageSheet(“assets/explosion.png”, options) sequences_explosion = { { name = “explosion”, start = 1, count = 40, time = 1000, loopCount = 0 } }

Sprite animation playback:

function spawnExplosion(x, y) local animExplosion = display.newSprite(sheetExplosion, sequences\_explosion) animExplosion:addEventListener("sprite", explosionListener) animExplosion:setSequence("explosion") animExplosion.x = x animExplosion.y = y animExplosion:play() end

…so why is the animation looping, when I’m using the ‘explosion’ sequence which has ‘loopCount’ set to ‘0’?

Thanks!

Bryan

loopCount = 0 means loop without end. If you want your sprite sheet to play only once when you call animExplosion:play()

Set the loopCount = 1

Check out the Sprite Animation guide for more info on sprite sheets: https://docs.coronalabs.com/daily/guide/media/spriteAnimation/index.html#sprite-animation

Thanks-- I had realized my mistake shortly after I created this post… :slight_smile:

Bryan

loopCount = 0 means loop without end. If you want your sprite sheet to play only once when you call animExplosion:play()

Set the loopCount = 1

Check out the Sprite Animation guide for more info on sprite sheets: https://docs.coronalabs.com/daily/guide/media/spriteAnimation/index.html#sprite-animation

Thanks-- I had realized my mistake shortly after I created this post… :slight_smile:

Bryan