Hi! Im trying to get a character to stare, and then blink once every 5 seconds, however he end up blinking constantly.
How can I get my character to automatically swich between my sequenceData?
This is my code:
[lua]local sheetData = { width=291.49, height=177.49, numFrames=6, sheetContentWidth=1748, sheetContentHeight=177 }
local sequenceData = {
{ name=“stare”, start=1, count=1, time=5000, loopCount = 1 },
{ name=“blink”, start=1, count=6, time=250, loopCount = 1, loopDirection = “bounce” },
{ name=“test”, start=3, count=6, time=1000, loopCount = 2 },
}
local mySheet = graphics.newImageSheet( “blink.png”, sheetData )
local eyes = display.newSprite( mySheet, sequenceData )
eyes.x = display.contentCenterX
eyes.y = display.contentCenterY
eyes:play()
local function spriteListener( event )
local blinking = event.target
if ( event.phase == “ended” ) then
blinking:setSequence( “blink” )
blinking:play()
end
end
eyes:addEventListener( “sprite”, spriteListener )[/lua]
Thank you