Multiple pages?

Hello. I am new to the storyboard api. I am not sure if i am understanding it correctly. I made a new project from selecting NEW in the corona simulator.

I selected physics game with storyboard api. I understand the basics of the storyboard api but how do I add multiple pages? The default sample file only has one storyboard page before it goes to the falling crate.

Thanks for any help! [import]uid: 157993 topic_id: 33558 reply_id: 333558[/import]

You should have a file called “scenetemplate.lua”, just copy that to a new file like “game.lua” or “help.lua” and edit it to have whatever content you want. Then to get to those scenes do a

storyboard.gotoScene(“help”)

for instance.

[import]uid: 199310 topic_id: 33558 reply_id: 133372[/import]

Only files i get generated are MAIN, CONFIG, LEVEL1, and MENU

I dont get a SCENETEMPLATE

Basically i want to add one storyboard scene (one file).
Im wondering maybe i can duplicate the MENU file and change where the second one goes? perhaps rename it, etc,

I tried this approach and it didnt work. Not sure what Im doing wrong…
[import]uid: 157993 topic_id: 33558 reply_id: 133415[/import]

Is this the screen you are seeing? What version of Corona SDK are you running? I’m not seeing Physics game With Storyboard.

From this screen if you pick “Scene” you will get the storyboard template. You can use this as your starting point:

----------------------------------------------------------------------------------  
--  
-- scenetemplate.lua  
--  
----------------------------------------------------------------------------------  
  
local storyboard = require( "storyboard" )  
local scene = storyboard.newScene()  
  
----------------------------------------------------------------------------------  
--   
-- NOTE:  
--   
-- Code outside of listener functions (below) will only be executed once,  
-- unless storyboard.removeScene() is called.  
--   
---------------------------------------------------------------------------------  
  
---------------------------------------------------------------------------------  
-- BEGINNING OF YOUR IMPLEMENTATION  
---------------------------------------------------------------------------------  
  
-- Called when the scene's view does not exist:  
function scene:createScene( event )  
 local group = self.view  
  
 -----------------------------------------------------------------------------  
  
 -- CREATE display objects and add them to 'group' here.  
 -- Example use-case: Restore 'group' from previously saved state.  
  
 -----------------------------------------------------------------------------  
  
end  
-- Called immediately after scene has moved onscreen:  
function scene:enterScene( event )  
 local group = self.view  
  
 -----------------------------------------------------------------------------  
  
 -- INSERT code here (e.g. start timers, load audio, start listeners, etc.)  
  
 -----------------------------------------------------------------------------  
  
end  
-- Called when scene is about to move offscreen:  
function scene:exitScene( event )  
 local group = self.view  
  
 -----------------------------------------------------------------------------  
  
 -- INSERT code here (e.g. stop timers, remove listeners, unload sounds, etc.)  
  
 -----------------------------------------------------------------------------  
  
end  
-- Called prior to the removal of scene's "view" (display group)  
function scene:destroyScene( event )  
 local group = self.view  
  
 -----------------------------------------------------------------------------  
  
 -- INSERT code here (e.g. remove listeners, widgets, save state, etc.)  
  
 -----------------------------------------------------------------------------  
  
end  
---------------------------------------------------------------------------------  
-- END OF YOUR IMPLEMENTATION  
---------------------------------------------------------------------------------  
  
-- "createScene" event is dispatched if scene's view does not exist  
scene:addEventListener( "createScene", scene )  
  
-- "enterScene" event is dispatched whenever scene transition has finished  
scene:addEventListener( "enterScene", scene )  
  
-- "exitScene" event is dispatched before next scene's transition begins  
scene:addEventListener( "exitScene", scene )  
  
-- "destroyScene" event is dispatched before view is unloaded, which can be  
-- automatically unloaded in low memory situations, or explicitly via a call to  
-- storyboard.purgeScene() or storyboard.removeScene().  
scene:addEventListener( "destroyScene", scene )  
  
---------------------------------------------------------------------------------  
  
return scene  

[import]uid: 199310 topic_id: 33558 reply_id: 133419[/import]

Okay, so:

can I use this SCENETEMPLATE file as a starting point for all my scenes (change file name, etc.,)?

I want to create multiple scenes that transpire as the user taps a “next” button. Is there a video about the storyboard api available somewhere? I did a check and didn’t find any.

Thanks! [import]uid: 157993 topic_id: 33558 reply_id: 133446[/import]

Exactly. That’s what the scenetemplate.lua file is for. In fact to make your life easier, If you’re always going to have a background image and some buttons standard from scene to scene, build them in the scenetemplate.lua file, then copy them to each scene you need and then change them as necessary. That way you don’t have to type in the code for your background and prev/next buttons for each scene, just change the background image and the scene names that next and prev goto.
[import]uid: 199310 topic_id: 33558 reply_id: 133479[/import]

Exactly. That’s what the scenetemplate.lua file is for. In fact to make your life easier, If you’re always going to have a background image and some buttons standard from scene to scene, build them in the scenetemplate.lua file, then copy them to each scene you need and then change them as necessary. That way you don’t have to type in the code for your background and prev/next buttons for each scene, just change the background image and the scene names that next and prev goto.
[import]uid: 199310 topic_id: 33558 reply_id: 133480[/import]

I tried it out and it works however it seems like things are piling on each other scene by scene. For instance, im at scene 1 and go to scene 2; everything works it goes to scene 2, but scene 1 is under scene 2 it has not been garbage collected or deleted.

Im wondering what would be the best measure for going to a scene but also deleting the previous scene out of memory?

Thanks Rob. [import]uid: 157993 topic_id: 33558 reply_id: 133495[/import]

You should have a file called “scenetemplate.lua”, just copy that to a new file like “game.lua” or “help.lua” and edit it to have whatever content you want. Then to get to those scenes do a

storyboard.gotoScene(“help”)

for instance.

[import]uid: 199310 topic_id: 33558 reply_id: 133372[/import]

Only files i get generated are MAIN, CONFIG, LEVEL1, and MENU

I dont get a SCENETEMPLATE

Basically i want to add one storyboard scene (one file).
Im wondering maybe i can duplicate the MENU file and change where the second one goes? perhaps rename it, etc,

I tried this approach and it didnt work. Not sure what Im doing wrong…
[import]uid: 157993 topic_id: 33558 reply_id: 133415[/import]

Is this the screen you are seeing? What version of Corona SDK are you running? I’m not seeing Physics game With Storyboard.

From this screen if you pick “Scene” you will get the storyboard template. You can use this as your starting point:

----------------------------------------------------------------------------------  
--  
-- scenetemplate.lua  
--  
----------------------------------------------------------------------------------  
  
local storyboard = require( "storyboard" )  
local scene = storyboard.newScene()  
  
----------------------------------------------------------------------------------  
--   
-- NOTE:  
--   
-- Code outside of listener functions (below) will only be executed once,  
-- unless storyboard.removeScene() is called.  
--   
---------------------------------------------------------------------------------  
  
---------------------------------------------------------------------------------  
-- BEGINNING OF YOUR IMPLEMENTATION  
---------------------------------------------------------------------------------  
  
-- Called when the scene's view does not exist:  
function scene:createScene( event )  
 local group = self.view  
  
 -----------------------------------------------------------------------------  
  
 -- CREATE display objects and add them to 'group' here.  
 -- Example use-case: Restore 'group' from previously saved state.  
  
 -----------------------------------------------------------------------------  
  
end  
-- Called immediately after scene has moved onscreen:  
function scene:enterScene( event )  
 local group = self.view  
  
 -----------------------------------------------------------------------------  
  
 -- INSERT code here (e.g. start timers, load audio, start listeners, etc.)  
  
 -----------------------------------------------------------------------------  
  
end  
-- Called when scene is about to move offscreen:  
function scene:exitScene( event )  
 local group = self.view  
  
 -----------------------------------------------------------------------------  
  
 -- INSERT code here (e.g. stop timers, remove listeners, unload sounds, etc.)  
  
 -----------------------------------------------------------------------------  
  
end  
-- Called prior to the removal of scene's "view" (display group)  
function scene:destroyScene( event )  
 local group = self.view  
  
 -----------------------------------------------------------------------------  
  
 -- INSERT code here (e.g. remove listeners, widgets, save state, etc.)  
  
 -----------------------------------------------------------------------------  
  
end  
---------------------------------------------------------------------------------  
-- END OF YOUR IMPLEMENTATION  
---------------------------------------------------------------------------------  
  
-- "createScene" event is dispatched if scene's view does not exist  
scene:addEventListener( "createScene", scene )  
  
-- "enterScene" event is dispatched whenever scene transition has finished  
scene:addEventListener( "enterScene", scene )  
  
-- "exitScene" event is dispatched before next scene's transition begins  
scene:addEventListener( "exitScene", scene )  
  
-- "destroyScene" event is dispatched before view is unloaded, which can be  
-- automatically unloaded in low memory situations, or explicitly via a call to  
-- storyboard.purgeScene() or storyboard.removeScene().  
scene:addEventListener( "destroyScene", scene )  
  
---------------------------------------------------------------------------------  
  
return scene  

[import]uid: 199310 topic_id: 33558 reply_id: 133419[/import]

Okay, so:

can I use this SCENETEMPLATE file as a starting point for all my scenes (change file name, etc.,)?

I want to create multiple scenes that transpire as the user taps a “next” button. Is there a video about the storyboard api available somewhere? I did a check and didn’t find any.

Thanks! [import]uid: 157993 topic_id: 33558 reply_id: 133446[/import]

Exactly. That’s what the scenetemplate.lua file is for. In fact to make your life easier, If you’re always going to have a background image and some buttons standard from scene to scene, build them in the scenetemplate.lua file, then copy them to each scene you need and then change them as necessary. That way you don’t have to type in the code for your background and prev/next buttons for each scene, just change the background image and the scene names that next and prev goto.
[import]uid: 199310 topic_id: 33558 reply_id: 133479[/import]

Exactly. That’s what the scenetemplate.lua file is for. In fact to make your life easier, If you’re always going to have a background image and some buttons standard from scene to scene, build them in the scenetemplate.lua file, then copy them to each scene you need and then change them as necessary. That way you don’t have to type in the code for your background and prev/next buttons for each scene, just change the background image and the scene names that next and prev goto.
[import]uid: 199310 topic_id: 33558 reply_id: 133480[/import]

I tried it out and it works however it seems like things are piling on each other scene by scene. For instance, im at scene 1 and go to scene 2; everything works it goes to scene 2, but scene 1 is under scene 2 it has not been garbage collected or deleted.

Im wondering what would be the best measure for going to a scene but also deleting the previous scene out of memory?

Thanks Rob. [import]uid: 157993 topic_id: 33558 reply_id: 133495[/import]