Use Sprite Sheet only once

I’ve reading about Sprite Sheets and thanks to the Corona docs and Peach Pellen’s tutorials, I think I have a pretty good grasp. Here’s my problem.

I have a jump Sprite Set and a run Sprite Set. How do I play the jump Sprite Set once and return to the run sprite set?

[code]
sprite.add( charSet, “jump”, 1, 14, 500, -2)
sprite.add( charSet, “run”, 15, 8, 400, -2)

–Somewhere later
char:prepare(“run”)
char:play()

local function Touch(event)
if event.phase == “began” then
–Make char jump
char:prepare(“jump”)
char:play()
end
end

jumpButton:addEventListener( “touch”, Touch )

[/code] [import]uid: 74059 topic_id: 18086 reply_id: 318086[/import]

[lua]local function charRun (event)
if event.phase == “end” then
char:prepare(“run”)
char:play()
end
end
char:addEventListener(“sprite”, charRun)[/lua]

That would play the run animation when the jump finishes, I believe. There would be other ways to do it as well, for example have an “onGround” function when it lands, etc.

Peach :slight_smile: [import]uid: 52491 topic_id: 18086 reply_id: 69301[/import]