Sorry Rob I didn’t mean to insult you or your code, I know I’m the problem. I’ve got my tabs set up from left to right, starting with
build.settings
settings = { orientation = { -- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight default = "landscapeRight", supported = { "landscapeRight", }, }, -- -- Android section -- android = { usesPermissions = { "android.permission.INTERNET", }, }, -- -- iOS section -- iphone = { --xcassets = "Images.xcassets", -- Removed string --- plist = { UIStatusBarHidden = false, UILaunchStoryboardName = "LaunchScreen", }, }, -- -- Plugins section -- plugins = { }, -- -- Project section -- excludeFiles = { -- Exclude unnecessary files for each platform all = { "Icon.png", "Icon-\*dpi.png", "Images.xcassets", }, android = { "LaunchScreen.storyboardc", }, }, }
config
application = { content = { width = 320, height = 480, scale = "letterbox", fps = 60, --[[imageSuffix = { ["@2x"] = 2, ["@4x"] = 4, }, --]] }, }
main
display.setStatusBar( display.HiddenStatusBar ) -- include the Corona "composer" module --- local composer = require "composer" -- load menu screen --- composer.gotoScene( "menu" )
menu
local composer = require( "composer" ) local scene = composer.newScene() -- include Corona's "widget" library --- local widget = require "widget" -- include Corona's "physics" library local physics = require "physics" ----------------------------------------------------------------------------------------- local playBtn1 local function onPlayBtn1Release() -- 'onRelease' event listener for playBtn --- composer.gotoScene( "level1", "fade", 500 ) return true -- indicates successful touch --- end ----------------------------------------------------------------------------------------- local playBtn2 local function onPlayBtn2Release() -- 'onRelease' event listener for playBtn --- composer.gotoScene( "options", "fade", 500 ) return true -- indicates successful touch --- end ----------------------------------------------------------------------------------------- function scene:create( event ) local sceneGroup = self.view -- display a background image --- local background = display.newImageRect( "background.png", display.actualContentWidth, display.actualContentHeight ) background.anchorX = 0 background.anchorY = 0 background.x = 0 + display.screenOriginX background.y = 0 + display.screenOriginY -- create/position logo/title image on upper-half of the screen --- local titleLogo = display.newImageRect( "logo.png", 300, 40 ) -- changed logo png --- titleLogo.x = display.contentCenterX titleLogo.y = 40 ----------------------------------------------------------------------------------------- playBtn1 = widget.newButton{ label="Levels", labelColor = { default={ 0, 0, 0 }, over={128} }, defaultFile="buttonDefault1.png", overFile="buttonOver1.png", width=100, height=30, onRelease = onPlayBtn1Release -- event listener function --- } playBtn1.x = display.contentCenterX playBtn1.y = display.contentHeight - 190 ----------------------------------------------------------------------------------------- playBtn2 = widget.newButton{ label="Options", labelColor = { default={ 0, 0, 0 }, over={128} }, defaultFile="buttonDefault2.png", overFile="buttonOver2.png", width=100, height=30, onRelease = onPlayBtn2Release -- event listener function --- } playBtn2.x = display.contentCenterX playBtn2.y = display.contentCenterY + 20 ----------------------------------------------------------------------------------------- -- all display objects must be inserted into group --- sceneGroup:insert( background ) sceneGroup:insert( titleLogo ) sceneGroup:insert( playBtn1 ) sceneGroup:insert( playBtn2 ) end ----------------------------------------------------------------------------------------- function scene:show( event ) local sceneGroup = self.view local phase = event.phase if phase == "will" then -- Called when the scene is still off screen and is about to move on screen --- elseif phase == "did" then -- Called when the scene is now on screen --- -- -- INSERT code here to make the scene come alive --- -- e.g. start timers, begin animation, play audio, etc. --- end end ----------------------------------------------------------------------------------------- function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if event.phase == "will" then -- Called when the scene is on screen and is about to move off screen --- -- -- INSERT code here to pause the scene --- -- e.g. stop timers, stop animation, unload sounds, etc.) --- elseif phase == "did" then -- Called when the scene is now off screen --- end end ----------------------------------------------------------------------------------------- function scene:destroy( event ) local sceneGroup = self.view -- Called prior to the removal of scene's "view" (sceneGroup) --- -- -- INSERT code here to cleanup the scene --- -- e.g. remove display objects, remove touch listeners, save state, etc. --- if playBtn1 then playBtn1:removeSelf() -- widgets must be manually removed --- playBtn1 = nil end end ----------------------------------------------------------------------------------------- -- Listener setup --- scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) ----------------------------------------------------------------------------------------- return scene
options
local composer = require( "composer" ) local scene = composer.newScene() -- include Corona's "widget" library local widget = require "widget" -- include Corona's "physics" library local physics = require "physics" ----------------------------------------------------------------------------------------- -- forward declarations and other locals local screenW, screenH, halfW = display.actualContentWidth, display.actualContentHeight, display.contentCenterX function scene:create( event ) -- Called when the scene's view does not exist. -- -- INSERT code here to initialize the scene -- e.g. add display objects to 'sceneGroup', add touch listeners, etc. local sceneGroup = self.view -- We need physics started to add bodies, but we don't want the simulation -- running until the scene is on the screen. physics.start() physics.pause() ----------------------------------------------------------------------------------------- local function onMenuTouch(event) if(event.phase == "ended") then composer.gotoScene("menu", "fade") end end ----------------------------------------------------------------------------------------- -- display a options background image --- local background = display.newImageRect( "background.png", display.actualContentWidth, display.actualContentHeight ) background.anchorX = 0 background.anchorY = 0 background.x = 0 + display.screenOriginX background.y = 0 + display.screenOriginY ----------------------------------------------------------------------------------------- --Function to handle button events --- local function handleButtonEvent( event ) if ( "ended" == event.phase ) then print( "Menu Button was pressed and released" ) end end local button1 = widget.newButton( { label="Menu", labelColor = { default={128}, over={128} }, width = 55, height = 20, defaultFile = "menuBtnDefault.png", overFile = "menuBtnOver.png", onEvent = handleButtonEvent } ) -- Center the button --- button1.x = display.contentCenterX -250 button1.y = display.contentCenterY -140 button1:addEventListener("touch", onMenuTouch) ----------------------------------------------------------------------------------------- local textObjColor = display.newText("Tap to select", 150, 20, native.systemFont, 20) textObjColor:setFillColor(0, 0, 0) textObjColor.x = display.contentCenterX - 160 textObjColor.y = display.contentCenterY - 40 ----------------------------------------------------------------------------------------- local pinkBall = display.newImageRect( "pinkBall.png", 25, 25 ) pinkBall.x = display.contentCenterX - 190 pinkBall.y = display.contentCenterY - 10 physics.addBody( pinkBall, "static", { density=1.0, radius=12 } ) local blueBall = display.newImageRect( "blueBall.png", 25, 25 ) blueBall.x = display.contentCenterX - 150 blueBall.y = display.contentCenterY - 10 physics.addBody( blueBall, "static", { density=1.0, radius=12 } ) local redBall = display.newImageRect( "redBall.png", 25, 25 ) redBall.x = display.contentCenterX - 110 redBall.y = display.contentCenterY - 10 physics.addBody( redBall, "static", { density=1.0, radius=12 } ) ----------------------------------------------------------------------------------------- sceneGroup:insert( background ) sceneGroup:insert( textObjColor ) sceneGroup:insert( button1 ) sceneGroup:insert( pinkBall ) sceneGroup:insert( blueBall ) sceneGroup:insert( redBall ) end ----------------------------------------------------------------------------------------- function scene:show( event ) local sceneGroup = self.view local phase = event.phase if phase == "will" then -- Called when the scene is still off screen and is about to move on screen elseif phase == "did" then -- Called when the scene is now on screen -- -- INSERT code here to make the scene come alive -- e.g. start timers, begin animation, play audio, etc. physics.start() end end ----------------------------------------------------------------------------------------- function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if event.phase == "will" then -- Called when the scene is on screen and is about to move off screen -- -- INSERT code here to pause the scene -- e.g. stop timers, stop animation, unload sounds, etc.) physics.stop() elseif phase == "did" then -- Called when the scene is now off screen end end ----------------------------------------------------------------------------------------- function scene:destroy( event ) -- Called prior to the removal of scene's "view" (sceneGroup) -- -- INSERT code here to cleanup the scene -- e.g. remove display objects, remove touch listeners, save state, etc. local sceneGroup = self.view package.loaded[physics] = nil physics = nil end ----------------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) ----------------------------------------------------------------------------------------- return scene
level1
local composer = require( "composer" ) local scene = composer.newScene() -- include Corona's "widget" library local widget = require "widget" -- include Corona's "physics" library local physics = require "physics" physics.start() physics.setGravity( 0, 9.8 ) ----------------------------------------------------------------------------------------- -- forward declarations and other locals local screenW, screenH, halfW = display.actualContentWidth, display.actualContentHeight, display.contentCenterX function scene:create( event ) local sceneGroup = self.view -- We need physics started to add bodies, but we don't want the simulaton -- running until the scene is on the screen. physics.start() physics.pause() ----------------------------------------------------------------------------------------- local function onMenuTouch(event) if(event.phase == "ended") then composer.gotoScene("menu", "fade") end end ----------------------------------------------------------------------------------------- -- display a background image --- local background = display.newImageRect( "background.png", display.actualContentWidth, display.actualContentHeight ) background.anchorX = 0 background.anchorY = 0 background.x = 0 + display.screenOriginX background.y = 0 + display.screenOriginY ----------------------------------------------------------------------------------------- --Function to handle button events --- local function handleButtonEvent( event ) if ( "ended" == event.phase ) then print( "Menu Button was pressed and released" ) end end local button1 = widget.newButton( { label="Menu", labelColor = { default={128}, over={128} }, width = 55, height = 20, defaultFile = "menuBtnDefault.png", overFile = "menuBtnOver.png", onEvent = handleButtonEvent } ) -- Center the button --- button1.x = display.contentCenterX -250 button1.y = display.contentCenterY -140 button1:addEventListener("touch", onMenuTouch) ----------------------------------------------------------------------------------------- local button2 = widget.newButton( { label="Replay", -- Replay Button doesn't work, don't know that code either -- labelColor = { default={128}, over={128} }, width = 60, height = 20, defaultFile = "replayBtnDefault.png", overFile = "replayBtnOver.png", onEvent = handleButtonEvent } ) -- Center the button --- button2.x = display.contentCenterX +250 button2.y = display.contentCenterY -140 ----------------------------------------------------------------------------------------- local redBall = display.newImageRect( "redBall.png", 25, 25 ) redBall.x = 100 redBall.y = 55 physics.addBody( redBall, "dynamic", { density=1.0, friction=0.5, bounce=0.1, radius=12 } ) ----------------------------------------------------------------------------------------- local blackBlock = display.newImageRect( "blackBlock.png", 100, 40 ) blackBlock.x = 330 blackBlock.y = 190 physics.addBody( blackBlock, "static", { bounce=0.2 } ) ----------------------------------------------------------------------------------------- local greenBar1 = display.newImageRect("greenBar1.png", 70, 10) greenBar1.x = 98 greenBar1.y = 88 greenBar1.rotation=0 physics.addBody( greenBar1, "kinematic", { density=1.0, friction=0.3, bounce=1 } ) local greenBar2 = display.newImageRect("greenBar2.png", 70, 10) greenBar2.x = 200 greenBar2.y = 140 greenBar2.rotation=0 physics.addBody( greenBar2, "kinematic", { density=1.0, friction=0.3, bounce=1 } ) ----------------------------------------------------------------------------------------- sceneGroup:insert( background ) sceneGroup:insert( button1 ) sceneGroup:insert( button2 ) sceneGroup:insert( redBall ) sceneGroup:insert( blackBlock ) sceneGroup:insert( greenBar1 ) sceneGroup:insert( greenBar2 ) ------------------------------------------------------------------------------------------ local function doRectTouch( event ) local touchedObject = event.target if event.phase == "began" then display.getCurrentStage():setFocus( touchedObject ) -- sets focus on greenBar -- touchedObject.previousX = touchedObject.x touchedObject.previousY = touchedObject.y print("greenBar1 touched") elseif event.phase == "moved" then touchedObject.y = ( event.y - event.yStart ) + touchedObject.previousY print("greenBar1 moved") elseif event.phase == "ended" or event.phase == "cancelled" then display.getCurrentStage():setFocus(nil) -- removes focus from greenBar -- print("greenBar1 released") end return true end greenBar1:addEventListener( "touch", doRectTouch ) ----------------------------------------------------------------------------------------- local function greenBar1Tapped( event ) transition.to( greenBar1, { rotation=20, delta= true } ) end greenBar1:addEventListener( "tap", greenBar1Tapped ) end ----------------------------------------------------------------------------------------- function scene:show( event ) local sceneGroup = self.view local phase = event.phase if phase == "will" then -- Called when the scene is still off screen and is about to move on screen elseif phase == "did" then -- Called when the scene is now on screen -- -- INSERT code here to make the scene come alive -- e.g. start timers, begin animation, play audio, etc. physics.start() end end ----------------------------------------------------------------------------------------- function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if event.phase == "will" then -- Called when the scene is on screen and is about to move off screen -- -- INSERT code here to pause the scene -- e.g. stop timers, stop animation, unload sounds, etc.) physics.stop() elseif phase == "did" then -- Called when the scene is now off screen end end ----------------------------------------------------------------------------------------- function scene:destroy( event ) -- Called prior to the removal of scene's "view" (sceneGroup) -- -- INSERT code here to cleanup the scene -- e.g. remove display objects, remove touch listeners, save state, etc. local sceneGroup = self.view package.loaded[physics] = nil physics = nil end ----------------------------------------------------------------------------------------- -- Listener setup -- scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) ----------------------------------------------------------------------------------------- return scene
Well that’s all I’ve got right now; I have the Red ball code entered in level1, you know why.
Thank you for patience