Going back to the main menu of my game

Hey everyone,

Is there something with storyboard, where you can’t go back to the main menu from a different scene, farther down in the hierarchy of scenes. For example, my order is:

main menu --> select screen --> sub select screen --> game

I can only go back to the main menu with storyboard.gotoScene from the select screen, but I am unable to go back to the main menu from the sub select screen and the game screen. Could anyone tell me what the problem could be?

Thanks! [import]uid: 175550 topic_id: 31362 reply_id: 331362[/import]

Are you using gotoScene() or showOverlay()

using storyboard.gotoScene() you should be able to go anywhere but main.lua [import]uid: 19626 topic_id: 31362 reply_id: 125443[/import]

Hi rooldacool,

If your main menu is it’s own Lua file, then you can use storyboard.gotoScene() like robmiracle said.

Here’s how it would look:

local storyboard = require("storyboard")  
  
storyboard.gotoScene("Name Of Scene")  
  
--All you have to do is put in your LUA file name where it says "Name Of Scene", and then it should work only if it isn't the main.lua file. If it is, you are going to have to move all your code to a separate file.  

-Landon [import]uid: 111492 topic_id: 31362 reply_id: 125449[/import]

I used storyboard.gotoScene, and like rob said, I can go anywhere BUT the main.lua file. Should I use the director class to go back to my main menu? [import]uid: 175550 topic_id: 31362 reply_id: 125488[/import]

While you **CAN** do storyboard stuff within a single lua file, it’s really not designed to do that.

Here is what your app should be structured like:

main.lua -> menu.lua -> selectscreen.lua -> selectsubscreen.lua -> game.lua.

Any of those can go back to menu.lua, but main.lua typically doesn’t create any scenes. Its there to initialize things and start storyboard

My apps offer a little more structure:

main.lua -> splash.lua -> menu.lua -> game.lua
-> gamehelp.lua
-> gamesettings.lua
-> gamecredits.lua
-> highscore.lua

and the all call back to menu.lua when done.
[import]uid: 19626 topic_id: 31362 reply_id: 125490[/import]

Thank you for your help! [import]uid: 175550 topic_id: 31362 reply_id: 125491[/import]

Are you using gotoScene() or showOverlay()

using storyboard.gotoScene() you should be able to go anywhere but main.lua [import]uid: 19626 topic_id: 31362 reply_id: 125443[/import]

Hi rooldacool,

If your main menu is it’s own Lua file, then you can use storyboard.gotoScene() like robmiracle said.

Here’s how it would look:

local storyboard = require("storyboard")  
  
storyboard.gotoScene("Name Of Scene")  
  
--All you have to do is put in your LUA file name where it says "Name Of Scene", and then it should work only if it isn't the main.lua file. If it is, you are going to have to move all your code to a separate file.  

-Landon [import]uid: 111492 topic_id: 31362 reply_id: 125449[/import]

I used storyboard.gotoScene, and like rob said, I can go anywhere BUT the main.lua file. Should I use the director class to go back to my main menu? [import]uid: 175550 topic_id: 31362 reply_id: 125488[/import]

While you **CAN** do storyboard stuff within a single lua file, it’s really not designed to do that.

Here is what your app should be structured like:

main.lua -> menu.lua -> selectscreen.lua -> selectsubscreen.lua -> game.lua.

Any of those can go back to menu.lua, but main.lua typically doesn’t create any scenes. Its there to initialize things and start storyboard

My apps offer a little more structure:

main.lua -> splash.lua -> menu.lua -> game.lua
-> gamehelp.lua
-> gamesettings.lua
-> gamecredits.lua
-> highscore.lua

and the all call back to menu.lua when done.
[import]uid: 19626 topic_id: 31362 reply_id: 125490[/import]

Thank you for your help! [import]uid: 175550 topic_id: 31362 reply_id: 125491[/import]