Storyboard sucks, Is there any alternative?

Hello,

I am using storyboard and it sucks, Every time i change scene or refresh a scene it doesn’t delete everything and i have to manually reset everything (timers, eventListeners, functions, even variables are not reset).

Sometimes back i saw a post about a new scene manager corona has released in beta, but i can’t find it. Can somebody direct me please?

I think you might be talking about Composer. Docs can be found here:

http://docs.coronalabs.com/daily/api/library/composer/index.html

Storyboard is fine. If you’re not using it correctly then yes, it will suck, as will anything. Functions and variables will reset if you they have a local scope within the scene. Display objects will delete as long as they, or the groups they belong to, are inserted into the main scene view.

Yes, timers and event listeners will need to be deleted manually, but this is probably true of any other scene management system.

Scenes will stay in memory when you switch to another unless you specify otherwise. Use this code in the enterScene function of the new scene to delete the previous scene:

[lua]

local previous = storyboard.getPrevious()

if previous ~= “main” and previous then

      storyboard.removeScene(previous)

end

[/lua]

@nick_sherman, I had to post this up on twitter because I thought the tip was so good. 

Coolromin, if you don’t like Storyboard then you won’t like Composer. It’s basically the same thing.

As far as refreshing a scene goes, in the Composer docs it says this: 

The best practice for reloading scenes is to use an intermediate scene.

I’d modify that to say:

The best practice for reloading scenes is to NOT reload a scene.

I can’t think of any case where refreshing/reloading a scene would be necessary or even advisable. If you put your “positioning” code in functions rather than directly inside the scene create() or enter() functions, you can call it whenever you want – at the beginning of the level, when changing levels, when resetting the current level, etc. 

That makes using Storyboard/Composer *much* easier to use.

 Jay

Love the tip on using getPrevious() for the last scene - thanks!!!

mark i was using your tutorial 

here is my story board stuff its not working.

local storyboard = require (“storyboard”)

local scene = storyboard.newScene()

function scene:createScene(event)

function scene:enterScene(event)

function scene:exitScene(event)

end

function scene:destroyScene(event)

end

display.setStatusBar(display.HiddenStatusBar)

local storyboard = require (“storyboard”)

storyboard.gotoScene( “game” )

I think you might be talking about Composer. Docs can be found here:

http://docs.coronalabs.com/daily/api/library/composer/index.html

Storyboard is fine. If you’re not using it correctly then yes, it will suck, as will anything. Functions and variables will reset if you they have a local scope within the scene. Display objects will delete as long as they, or the groups they belong to, are inserted into the main scene view.

Yes, timers and event listeners will need to be deleted manually, but this is probably true of any other scene management system.

Scenes will stay in memory when you switch to another unless you specify otherwise. Use this code in the enterScene function of the new scene to delete the previous scene:

[lua]

local previous = storyboard.getPrevious()

if previous ~= “main” and previous then

      storyboard.removeScene(previous)

end

[/lua]

@nick_sherman, I had to post this up on twitter because I thought the tip was so good. 

Coolromin, if you don’t like Storyboard then you won’t like Composer. It’s basically the same thing.

As far as refreshing a scene goes, in the Composer docs it says this: 

The best practice for reloading scenes is to use an intermediate scene.

I’d modify that to say:

The best practice for reloading scenes is to NOT reload a scene.

I can’t think of any case where refreshing/reloading a scene would be necessary or even advisable. If you put your “positioning” code in functions rather than directly inside the scene create() or enter() functions, you can call it whenever you want – at the beginning of the level, when changing levels, when resetting the current level, etc. 

That makes using Storyboard/Composer *much* easier to use.

 Jay

Love the tip on using getPrevious() for the last scene - thanks!!!

mark i was using your tutorial 

here is my story board stuff its not working.

local storyboard = require (“storyboard”)

local scene = storyboard.newScene()

function scene:createScene(event)

function scene:enterScene(event)

function scene:exitScene(event)

end

function scene:destroyScene(event)

end

display.setStatusBar(display.HiddenStatusBar)

local storyboard = require (“storyboard”)

storyboard.gotoScene( “game” )