Perfect!!! great solution!!
Now I can run a sprite, then other sprite.
I tried to go on with the same “tecnique”, but I couldn’t.
The final idea is run an sprite, at the end of the first one runs another sprite, and at the end of the second sprite display an image.
This is the code, just the part wich shows the last image doesn’t work.
Could you see what I’m missing please?.
[lua]local sprite = require(“sprite”)
local instance1 = nil
local instance2 = nil
local function displayimage(event)
if (event.phase == “end”) then
instance2:removeEventListener( “sprite”, nextSprite)
–************Last image***********
– ***FASE 3*******
local bkg = display.newImage( “icon.png”, true )
bkg.x = display.contentWidth / 4 + 100
bkg.y = baseline - 75
–*********************************
end
return true
end
local function nextSprite(event)
if (event.phase == “end”) then
instance1:removeEventListener( “sprite”, nextSprite)
– ***FASE 2*******
local sheet2 = sprite.newSpriteSheet( “fase2.jpg”, 125, 200 )
local spriteSet2 = sprite.newSpriteSet(sheet2, 1, 8)
sprite.add( spriteSet2, “b”, 3, 6, 2300, 1)
instance2 = sprite.newSprite( spriteSet2 )
instance2.x = display.contentWidth / 4 + 16
instance2.y = baseline - 75
instance2:prepare(“b”)
instance2:play()
instance2:addEventListener( “sprite”, displayimage)
end
return true
end
–*******FASE1********************************
local sheet1 = sprite.newSpriteSheet( “fase1.jpg”, 125, 200 )
local spriteSet1 = sprite.newSpriteSet(sheet1, 1, 8)
sprite.add( spriteSet1, “a”, 1, 8, 170, 3)
instance1 = sprite.newSprite( spriteSet1 )
instance1.x = display.contentWidth / 4 + 16
instance1.y = baseline - 75
instance1:prepare(“a”)
instance1:play()
instance1:addEventListener( “sprite”, nextSprite)
–********************************************[/lua]
Thanks in advance. [import]uid: 54055 topic_id: 14014 reply_id: 52942[/import]