It’s in the createScene function.
local sheetData = {width = 225, height = 350, numFrames = 3, sheetContentWidth = 675, sheetContentHeight = 350} local mySheet = graphics.newImageSheet(\_G.images .. "\_sprite\_run.png", sheetData) local sequenceData = { {name = "walk", start = 1, count = 3, time = 800, loopCount = 0, loopDirection = "forward"}, {name = "run", start = 1, count = 3, time = 500, loopCount = 0, loopDirection = "forward"}, {name = "runFast", start = 1, count = 3, time = 300, loopCount = 0, loopDirection = "forward} } obj = display.newSprite(mySheet, sequenceData) obj:setSequence("walk") obj.x = 450 obj.y = 200 obj.name = "player" obj:play()
The sequence change is in the enterScene function.
Here I got a runtime listener with the animate function.
Runtime:addEventListener("enterFrame", animate);
In the animate function the sequence change like this
if dist % 5 == 0 then --just for testing it multiple times runSpeed = runSpeed + 1 obj:setSequence("run") obj:play() end