Splash screen transition?

I see a lot of posts on delay timers but what I’m looking for is kind of the opposite I think. I’m trying to have my main.lua load a scene (using storyboard) Display an image and then change scenes automatically after like 5 seconds.

Here’s my main.lua so far

  
local storyboard = require "storyboard"  
  
-- Store the selected world and level  
storyboard.world = 0  
storyboard.level = 0  
  
-- load menu screen  
storyboard.gotoScene( "splashscreen" )  
storyboard.isDebug = true  
  

I’m just wondering how in my splashcsreen.lua do I display the image instantly and then fade to a new scene after a few seconds. I know how to display the image I’m just unclear about the timers being able to change scenes also instead of just fading out.
[import]uid: 72845 topic_id: 34568 reply_id: 334568[/import]

HI Focus Lab - here is what you can do…

In your splashscreen.lua file set up Storyboard and in the create event, load your splash screen image and assign it to the screen group.

Then add something like the code below. Essentially this creates a function that does the transition to the next scene which is called by the timer after x period of time.

[code]

local gotoNextScene = function()
storyboard.gotoScene( “MyNextScene”,“crossFade”, 500 )
end

local sceneTimer = timer.performWithDelay( 1000, gotoNextScene, 1 )

[/code] [import]uid: 190375 topic_id: 34568 reply_id: 137475[/import]

I’ve got it working but being a newbie to this language I’m getting some terminal errors. Here’s my code.

local storyboard = require( "storyboard" )  
local scene = storyboard.newScene()  
   
function scene:createScene( event )  
 local group = self.view  
  
-- Store the selected world and level  
storyboard.world = 0  
storyboard.level = 0  
-----------------------------------------------  
  
  
local focuslabs = display.newImage( "focuslabs.png" )  
group:insert(focuslabs)  
  
  
local gotonextscene = function()  
 storyboard.gotoScene( "splashscreen","crossFade", 500 )  
end  
   
local sceneTimer = timer.performWithDelay( 3000, gotonextscene, 1 )  
  
gotonextscene:addEventListener("event", gotonextscene)  
-------------------------------------------------  
end  
  
function scene:enterScene( event )  
 local group = self.view  
   
end  
   
function scene:exitScene( event )  
 local group = self.view  
   
end  
   
function scene:destroyScene( event )  
 local group = self.view  
   
end  
scene:addEventListener( "createScene", scene )  
scene:addEventListener( "enterScene", scene )  
scene:addEventListener( "exitScene", scene )  
scene:addEventListener( "destroyScene", scene )  
   
return scene  

Could you tell me where I went wrong by looking at the code? If I need to post the terminal error let me know.
[import]uid: 72845 topic_id: 34568 reply_id: 137737[/import]

skip the timers, do this:

main.lua

  
local storyboard = require "storyboard"  
storyboard.gotoScene( "splashscreen", "fade", 500 )  
  

splashscreen.lua

-- do this in the enterScene   
function scene:enterScene( event )  
 local group = self.view  
 storyboard.gotoScene( "menu","crossFade", 3500 )  
end  

[import]uid: 13560 topic_id: 34568 reply_id: 137738[/import]

Don’t skip the timers. Otherwise all you have is a long cross fade (dissolve). This is not going to show the scene for X period of time and then transition to the next scene.

As far as your errors, please post them so we can have a look. Also, I don’t think you need this: gotonextscene:addEventListener(“event”, gotonextscene)
[import]uid: 190375 topic_id: 34568 reply_id: 137740[/import]

Thanks! how do I delay the crossfade without it being the fade itself? IE. I can change the crossfade number and make it higher but that only effects the fade not how long the image is actually displayed. [import]uid: 72845 topic_id: 34568 reply_id: 137741[/import]

Focus Lab - Exactly - this is what the timer is for, thus why you need to KEEP the timer.

The scene will display for as long as you set the timer. Then the timer will fire and run the function which will do the fade or crossfade or whatever type of transition you want. [import]uid: 190375 topic_id: 34568 reply_id: 137742[/import]

Didn’t see your second post Tim. Got it all working properly now. Thanks guys. [import]uid: 72845 topic_id: 34568 reply_id: 137745[/import]

Hi FocusLab,

Do you mind posting the corrected version for the rest of us newbies?

thanks!

amishtravel [import]uid: 179798 topic_id: 34568 reply_id: 137982[/import]

Sure no problem amishtravel.

Here ya go:

local focuslabs = display.newImage( "focuslabs.png" ) --Your splash image  
group:insert(focuslabs)  
  
local gotonextscene = function()  
 storyboard.gotoScene( "menuscreen","crossFade", 500 ) --Your next scene  
  
end  
local sceneTimer = timer.performWithDelay( 3000, gotonextscene, 1 ) --Splash timer  

For scene change I use storyboard (as you can probably see). Hope this helps.
[import]uid: 72845 topic_id: 34568 reply_id: 137987[/import]

HI Focus Lab - here is what you can do…

In your splashscreen.lua file set up Storyboard and in the create event, load your splash screen image and assign it to the screen group.

Then add something like the code below. Essentially this creates a function that does the transition to the next scene which is called by the timer after x period of time.

[code]

local gotoNextScene = function()
storyboard.gotoScene( “MyNextScene”,“crossFade”, 500 )
end

local sceneTimer = timer.performWithDelay( 1000, gotoNextScene, 1 )

[/code] [import]uid: 190375 topic_id: 34568 reply_id: 137475[/import]

I’ve got it working but being a newbie to this language I’m getting some terminal errors. Here’s my code.

local storyboard = require( "storyboard" )  
local scene = storyboard.newScene()  
   
function scene:createScene( event )  
 local group = self.view  
  
-- Store the selected world and level  
storyboard.world = 0  
storyboard.level = 0  
-----------------------------------------------  
  
  
local focuslabs = display.newImage( "focuslabs.png" )  
group:insert(focuslabs)  
  
  
local gotonextscene = function()  
 storyboard.gotoScene( "splashscreen","crossFade", 500 )  
end  
   
local sceneTimer = timer.performWithDelay( 3000, gotonextscene, 1 )  
  
gotonextscene:addEventListener("event", gotonextscene)  
-------------------------------------------------  
end  
  
function scene:enterScene( event )  
 local group = self.view  
   
end  
   
function scene:exitScene( event )  
 local group = self.view  
   
end  
   
function scene:destroyScene( event )  
 local group = self.view  
   
end  
scene:addEventListener( "createScene", scene )  
scene:addEventListener( "enterScene", scene )  
scene:addEventListener( "exitScene", scene )  
scene:addEventListener( "destroyScene", scene )  
   
return scene  

Could you tell me where I went wrong by looking at the code? If I need to post the terminal error let me know.
[import]uid: 72845 topic_id: 34568 reply_id: 137737[/import]

skip the timers, do this:

main.lua

  
local storyboard = require "storyboard"  
storyboard.gotoScene( "splashscreen", "fade", 500 )  
  

splashscreen.lua

-- do this in the enterScene   
function scene:enterScene( event )  
 local group = self.view  
 storyboard.gotoScene( "menu","crossFade", 3500 )  
end  

[import]uid: 13560 topic_id: 34568 reply_id: 137738[/import]

Don’t skip the timers. Otherwise all you have is a long cross fade (dissolve). This is not going to show the scene for X period of time and then transition to the next scene.

As far as your errors, please post them so we can have a look. Also, I don’t think you need this: gotonextscene:addEventListener(“event”, gotonextscene)
[import]uid: 190375 topic_id: 34568 reply_id: 137740[/import]

Thanks! how do I delay the crossfade without it being the fade itself? IE. I can change the crossfade number and make it higher but that only effects the fade not how long the image is actually displayed. [import]uid: 72845 topic_id: 34568 reply_id: 137741[/import]

Focus Lab - Exactly - this is what the timer is for, thus why you need to KEEP the timer.

The scene will display for as long as you set the timer. Then the timer will fire and run the function which will do the fade or crossfade or whatever type of transition you want. [import]uid: 190375 topic_id: 34568 reply_id: 137742[/import]

Didn’t see your second post Tim. Got it all working properly now. Thanks guys. [import]uid: 72845 topic_id: 34568 reply_id: 137745[/import]

Hi FocusLab,

Do you mind posting the corrected version for the rest of us newbies?

thanks!

amishtravel [import]uid: 179798 topic_id: 34568 reply_id: 137982[/import]

Sure no problem amishtravel.

Here ya go:

local focuslabs = display.newImage( "focuslabs.png" ) --Your splash image  
group:insert(focuslabs)  
  
local gotonextscene = function()  
 storyboard.gotoScene( "menuscreen","crossFade", 500 ) --Your next scene  
  
end  
local sceneTimer = timer.performWithDelay( 3000, gotonextscene, 1 ) --Splash timer  

For scene change I use storyboard (as you can probably see). Hope this helps.
[import]uid: 72845 topic_id: 34568 reply_id: 137987[/import]

what about destroying the scene because it appears in my menu.