I’ve been lurking, and studying and playing and learning. Kudos to all the helpful folks here. I seem to have a mental block on tween.delay usage for timing. I was hoping to use it to time an ending sequence for a game level.

boomSequence - > ids of images on a tile sheet.

tileMap - > background tile map (holds ids of tile images)

I have 3 as a delay which is obviously absurd but the tiles change immediately.

This is called with endSequence(endx,endy,1)

Getting the animation to work other ways is not a problem but I thought this approach should work. Thanks.

```
boomSequence = {259,269,279,289,299,309,319,225}
function endSequence(x,y,index)
tileMap[y-1][x-1] = boomSequence[index]
tileMap[y][x-1] = boomSequence[index]
tileMap[y+1][x-1] = boomSequence[index]
tileMap[y-1][x] = boomSequence[index]
tileMap[y][x] = boomSequence[index]
tileMap[y+1][x] = boomSequence[index]
tileMap[y-1][x+1] = boomSequence[index]
tileMap[y][x+1] = boomSequence[index]
tileMap[y+1][x+1] = boomSequence[index]
if index < #boomSequence then
tween.delay(3, endSequence(x,y,index + 1))
end
end
```

EDIT: Interesting: found a post by Briarfox earlier today which led me to this which does work. I’d still love an explanation why the first does not work. (old brain cells) Thank you.

```
boomSequence = {259,269,279,289,299,309,319,225}
function endSequence(x,y,index)
tileMap[y-1][x-1] = boomSequence[index]
tileMap[y][x-1] = boomSequence[index]
tileMap[y+1][x-1] = boomSequence[index]
tileMap[y-1][x] = boomSequence[index]
tileMap[y][x] = boomSequence[index]
tileMap[y+1][x] = boomSequence[index]
tileMap[y-1][x+1] = boomSequence[index]
tileMap[y][x+1] = boomSequence[index]
tileMap[y+1][x+1] = boomSequence[index]
tween.delay(3, function()
if index < #boomSequence then
endSequence(x,y,index + 1)
end
end)
end
```