Hi, do you know howto add a skip button inside the sprite sheet? I’ve tried with this code:
– include the Corona “storyboard” module
local widget = require(“widget”)
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
–
– main.lua
–
local widget = require(“widget”)
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
local sheetData1 = { width=427, height=320, numFrames=24, sheetContentWidth=1708, sheetContentHeight=1920 }
local sheet1 = graphics.newImageSheet( “spritesheet.png”, sheetData1 )
– 2nd image sheet
local sheetData2 = { width=427, height=320, numFrames=12, sheetContentWidth=854, sheetContentHeight=1920 }
local sheet2 = graphics.newImageSheet( “spritesheet1.png”, sheetData2 )
local sequenceData = {
{ name=“seq1”, sheet=sheet1, start=1, count=28, time=13000, loopCount=1 },
{ name=“seq2”, sheet=sheet2, start=1, count=12, time=13000, loopCount=1 }
}
local myAnimation = display.newSprite( sheet1, sequenceData )
myAnimation.x = display.contentWidth/2 ; myAnimation.y = display.contentHeight/2
myAnimation:play()
– swap the sequence to ‘seq2’
local function swapSheet()
myAnimation:setSequence( “seq2” )
myAnimation:play()
end
timer.performWithDelay( 13000, swapSheet )
–load menu screen
local function mySpriteListener( event )
if ( event.phase == “ended” ) then
storyboard.gotoScene(“menu”)
end
end
local skipbutton = widget.newButton
{
defaultFile=“skip.png”,
onPress = function() storyboard.gotoScene(“menu”); end,
onEvent = buttonHandler,
}
but It won’t work … also when the animation ended how to goto the next scene ?
Thank you!