Hi all, I have the code below which animates four images contained in a spritesheet when the image is touched, starting with image 1 and stopping on image 4.
What I really would like to do would be to start with image 4 showing on the screen and, when it’s tapped, start the animation backwards so that it ends with image 1.
Thanks in advance for any advice,
Laddsa
[code]
require(“sprite”)
display.setStatusBar(display.HiddenStatusBar)
function touchimage (event)
if (event.phase ==“began”) then
event.target:prepare(“forward”)
event.target:play()
end
end
local data = require(“images”).getSpriteSheetData()
local sheet = sprite.newSpriteSheetFromData(“images.png”,data)
local myimage = sprite.newSpriteSet(sheet,1,4)
sprite.add( myimage, “forward”, 1 ,4, 350, 1)
local card = sprite.newSprite(myimage)
card.x = 60
card.y = 100
myimage:addEventListener( “touch”, touchimage)
[/code] [import]uid: 25313 topic_id: 9741 reply_id: 309741[/import]