Newbie Menu Question

Hi all,

I’ve just started making my first game with corona sdk and think I’m missing something with making a menu and going back and forth from the screens. I knocked up a couple of images for the menu screen and they all display correctly and that’s fine.

This is my Main.lua file and I have a blank Options.lua file in the correct location. What I am looking to do is go from the main menu screen the location depending on what button is pressed but for this example it will be the options button.

I have watched a lot of videos and read the documentation (I’ve left the failed code out) but I don’t seem to be able to achieve the following:

Appropriately remove the MainMenu screen

Go to the Options Screen

Press a button on this screen to return to the Main Menu screen.

Any help would be much appreciated :smiley:

–Main.lua

local composer = require( “composer” )
local scene = composer.newScene()

– Main Menu BackGround

local _W = display.contentCenterX
local _H =  display.contentCenterY
local background = display.newRect( _W, _H, display.contentWidth, display.contentHeight )
background.fill = { type=“image”, filename=“Background.png” }

–Main Menu Buttons Group

local Play = display.newImage(“PlayButton.png”, _W, _H*0.6)
local Options = display.newImage(“Options.png”, _W, _H* 0.9)
local HowToPlay = display.newImage(“HowToPlay.png”, _W, _H*1.2)
local LeaderBoards = display.newImage(“LeaderBoards.png”, _W, _H*1.5)
local Shop = display.newImage(“Shop.png”, _W, _H* 1.8)

–Separate File (completely blank) = Options.lua

Hi.  We did a whole talk on the Compose scene manager here:

https://coronalabs.com/blog/coronageek/composer-library-series-hangout-highlights/

The code (including samples like the one you’re working on) can be found here:

I posted these links instead of an answer because,

  1. The answer you need is in the samples.
  2. You’d be well served to browse this code, including the framework (folder 5_frame) that I made.  You may not entirely follow my organizational strategy, but it should give you a solid foundation for setting up, organizing, and using composer to manage your scenes.

Thank you for taking the time to reply I will take a look at the links!!

In addition to @roaminggamer’s excellent selection, consider these:

https://coronalabs.com/blog/2015/04/14/tutorial-the-basic-game-template/

This is a great starter project that has everything you need and shows you where to put everything in a Composer project.

You need to also understand scope:  https://coronalabs.com/blog/2011/09/21/tutorial-scopes-for-functions/

And managing data across scenes:   https://coronalabs.com/blog/2013/05/28/tutorial-goodbye-globals/

Rob

Guys this was perfect exactly what I was looking for I am past my first hurdle!

Hi.  We did a whole talk on the Compose scene manager here:

https://coronalabs.com/blog/coronageek/composer-library-series-hangout-highlights/

The code (including samples like the one you’re working on) can be found here:

I posted these links instead of an answer because,

  1. The answer you need is in the samples.
  2. You’d be well served to browse this code, including the framework (folder 5_frame) that I made.  You may not entirely follow my organizational strategy, but it should give you a solid foundation for setting up, organizing, and using composer to manage your scenes.

Thank you for taking the time to reply I will take a look at the links!!

In addition to @roaminggamer’s excellent selection, consider these:

https://coronalabs.com/blog/2015/04/14/tutorial-the-basic-game-template/

This is a great starter project that has everything you need and shows you where to put everything in a Composer project.

You need to also understand scope:  https://coronalabs.com/blog/2011/09/21/tutorial-scopes-for-functions/

And managing data across scenes:   https://coronalabs.com/blog/2013/05/28/tutorial-goodbye-globals/

Rob

Guys this was perfect exactly what I was looking for I am past my first hurdle!