I have a spriteSheet animation. The game is smooth and everything works great.
I have this event listener added to the instance of a sprite sheet animation.
chuteSpriteInstance:addEventListener(“sprite”, spriteEvent)
When the animation ends, the below function is called…
Basically the purpose of this is so that at the end of one complete animation, the sprite is replaced and a smaller, continually looping animation takes it’s place.
What is happening, however, is once the the below sprite is in the window a playing (it plays and loops properly) — the screen pauses every few seconds (only for a millisecond) – so it makes it look like there’s a hiccup in the game.
Any help is appreciated…
local function spriteEvent(cEvent)
print(cEvent.phase)
if cEvent.phase == “end” then
currentDudeXPos = cEvent.sprite.x
currentDudeYPos = cEvent.sprite.y
cEvent.sprite:removeEventListener(“sprite”, spriteEvent)
cEvent.sprite:removeSelf()
cEvent.sprite = nil
sprite.add(chuteSpriteSet2, “scarfWave”, 1,22,22,0)
chuteSpriteInstanceOpen = sprite.newSprite(chuteSpriteSet2)
chuteSpriteInstanceOpen:setReferencePoint(display.CenterReferencePoint)
print(“once”)
chuteSpriteInstanceOpen.x = currentDudeXPos
chuteSpriteInstanceOpen.y = currentDudeYPos
print(“two”)
chuteSpriteInstanceOpen:prepare(“scarfWave”)
chuteSpriteInstanceOpen:play()
transition.to(chuteSpriteInstanceOpen,{time=2000,y=170})
physics.addBody( chuteSpriteInstanceOpen, “dynamic”, { isSensor = true, density=2.0,friction=0.0 } )
end
end [import]uid: 4438 topic_id: 4378 reply_id: 304378[/import]