This should just about do it. Still around 200 lines but most is just comments or needed for composer. But its working and extremely minimal while still showing the fundamentals of what im doing.
-- ============================================================= -- mainMenu -- ============================================================= local composer = require( "composer" ) local scene = composer.newScene() ---------------------------------------------------------------------- -- REQUIRES -- ---------------------------------------------------------------------- local jsonFunct = require( "modAll" ) ---------------------------------------------------------------------- -- LOCALS -- ---------------------------------------------------------------------- -- JSON Variables local gameValues = jsonFunct.readGameValues() local storeValues = jsonFunct.readStoreValues() --Assigned JSON Variables local coins = gameValues[1] local lives = gameValues[2] -- Display Variables local dW = display.contentWidth local dH = display.contentHeight local cX = display.contentCenterX local cY = display.contentCenterY local images = {} local screenName = "none" local handleTransitions local sceneName -- Forward Declarations local goToLevelChooser ---------------------------------------------------------------------- ---------------------------------------------------------------------- function scene:create( event ) local sceneGroup = self.view ---------------------------------------------------------------------- -- CREATE IMAGES -- ---------------------------------------------------------------------- --Create Image Groups bgGroup = display.newGroup() sceneGroup:insert( bgGroup ) difficultyChooserGroup = display.newGroup() sceneGroup:insert( difficultyChooserGroup ) --Function to Create Images local function createImage(dispGroup, imageLoc, xSize, ySize, xLoc, yLoc) local i = display.newImageRect(dispGroup, imageLoc, xSize, ySize ) i.x = xLoc i.y = yLoc return i end --Create Background Group images.background = createImage(bgGroup, "mainBackground.png", dW\*3, dH, cX, cY) images.bottomCake = createImage(bgGroup, "mainBottom.png", dW\*.75, dW\*.22, cX, dH\*.85) images.candyWord = createImage(bgGroup, "candy.png", dW\*.456, dW \*0.19, cX, dH\*0.26) images.blueCandy = createImage(bgGroup, "mainMiddle2.png", dW\*.2, dW\*.2, dW\*.43, dH\*.49) images.pinkCandy = createImage(bgGroup, "mainMiddle.png", dW\*.2, dW\*.2, dW\*.54, dH\*.47) images.wordsWord = createImage(bgGroup, "words.png", dW\*.456, dW\*.19, cX,dH\*.53 ) images.playButton = createImage(bgGroup, "playButton.png", dW\*.15, dW\*.15, cX,dH\*.8 ) images.menuButton = createImage(bgGroup, "settingsButton.png", dW\*.11, dW\*.11, (cX-(dW\*.17)), dH\*.83 ) images.storeButton = createImage(bgGroup, "purchaseButton.png", dW\*.11, dW\*.11, (cX+(dW\*.17)), dH\*.83 ) --Difficulty Chooser (Play Button) Group images.backWindowDifficultyChooser = display.newRect(difficultyChooserGroup, cX, cY+(dH\*1.5), dW\*2, dH\*2) images.backWindowDifficultyChooser.fill = {.13, .92} images.difficultyChooserPauseWindow = createImage(difficultyChooserGroup, "pauseWindow.png", dW\*.82, dH, cX, cY+dH) images.difficultyChooserExitButton = createImage(difficultyChooserGroup, "exit.png", dW\*.08, dW\*.08, dW\*.84, dH\*.23+dH) images.difficultyWord = createImage(difficultyChooserGroup, "difficulty.png", dW\*.35, dW\*.092, cX, dH\*.16+dH) images.hardChooser = createImage(difficultyChooserGroup, "difficultyChooser3.png", dW\*.18, dH\*.49, dW\*.73, dH\*.61+dH) images.mediumChooser = createImage(difficultyChooserGroup, "difficultyChooser2.png", dW\*.18, dH\*.49, dW\*.5, dH\*.61+dH) images.easyChooser = createImage(difficultyChooserGroup, "difficultyChooser1.png", dW\*.18, dH\*.49, dW\*.27, dH\*.61+dH) ---------------------------------------------------------------------- -- Transition Handlers -- ---------------------------------------------------------------------- --Transition Screens Down local function transitionExitWindows(event) local phase = event.phase if ( phase == "ended" ) then if screenName=="difficultyChooser" then handleTransitions = transition.to(difficultyChooserGroup, {time=450, y=dH+dH, transition=easing.inBack} ) end screenName="none" end return true end --Transition Windows To Screen local function transitionToScreen(event) local target = event.target local phase = event.phase if ( phase == "ended") then if target==images.playButton and screenName=="none" then screenName="difficultyChooser" handleTransitions = transition.to(difficultyChooserGroup, {time=450, y=-dH, transition=easing.outBack} ) end end return true end ---------------------------------------------------------------------- -- Change Screen -- ---------------------------------------------------------------------- local function changeScene(event) local target = event.target local phase = event.phase if ( phase=="began" ) then audio.stop(2) audio.play(clickSound, {channel=2} ) elseif ( phase == "ended" and screenName=="difficultyChooser") then if target==images.easyChooser then sceneName="easyLevelChooser" elseif target==images.mediumChooser then sceneName="mediumLevelChooser" elseif target==images.hardChooser then sceneName="hardLevelChooser" end handleTransitions = transition.to(difficultyChooserGroup, {time=450, y=dH+dH, transition=easing.inBack, onComplete=goToLevelChooser} ) end return true end ---------------------------------------------------------------------- -- Create Event Listeners -- ---------------------------------------------------------------------- images.playButton:addEventListener( "touch", transitionToScreen )-- Play Button images.easyChooser:addEventListener( "touch", changeScene )-- Hard Level Chooser images.mediumChooser:addEventListener( "touch", changeScene )-- Hard Level Chooser images.hardChooser:addEventListener( "touch", changeScene )-- Hard Level Chooser end ---------------------------------------------------------------------- ---------------------------------------------------------------------- function scene:willEnter( event ) local sceneGroup = self.view end ---------------------------------------------------------------------- ---------------------------------------------------------------------- function scene:didEnter( event ) local sceneGroup = self.view end ---------------------------------------------------------------------- ---------------------------------------------------------------------- function scene:willExit( event ) local sceneGroup = self.view end ---------------------------------------------------------------------- ---------------------------------------------------------------------- function scene:didExit( event ) local sceneGroup = self.view audio.dispose( clickSound ) clickSound = nil audio.dispose( freeGiftSound ) freeGiftSound = nil end ---------------------------------------------------------------------- ---------------------------------------------------------------------- function scene:destroy( event ) local sceneGroup = self.view end ---------------------------------------------------------------------- -- FUNCTION/CALLBACK DEFINITIONS -- ---------------------------------------------------------------------- goToLevelChooser = function ( self, event ) local options = { effect = "fromBottom", time = 750, } composer.gotoScene( sceneName, options ) return true end --------------------------------------------------------------------------------- -- Scene Dispatch Events, Etc. --------------------------------------------------------------------------------- function scene:show( event ) local sceneGroup = self.view local willDid = event.phase if( willDid == "will" ) then self:willEnter( event ) elseif( willDid == "did" ) then self:didEnter( event ) end end function scene:hide( event ) local sceneGroup = self.view local willDid = event.phase if( willDid == "will" ) then self:willExit( event ) elseif( willDid == "did" ) then self:didExit( event ) end end scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) --------------------------------------------------------------------------------- return scene