changing scene error

Did you just copy main.lua from there and call it game.lua?  If so, thats going to be a problem.  The main.lua isn’t a “scene”.  It doesn’t have the event’s defined.  It doesn’t load the composer module and define a new scene.  You can’t drop in any lua file and have Composer use it as a scene.

Rob

what i did is Put main.lua file along with scene1.lua scene2 scene3 scene4 and scene template in simple test pool folder 

Main lua now going correctly till scene 4  … then i make new file name game.lua copy all code which i got from simple test pool main file but the file is not changing or redirecting i m getting run time error even though i try to make new file name and put nothing there but still same error it maybe because of different api or what i m stuck in this i just want to go to main menu of game.lua after scene changed and then goes to game.lua

Does game.lua start with these two lines:
 

local composer = require( “composer” )

local scene = composer.newScene()

and end with:

scene:addEventListener( “create”, scene )
scene:addEventListener( “show”, scene )
scene:addEventListener( “hide”, scene )
scene:addEventListener( “destroy”, scene )

return scene

and have functions defined:

function scene:create

function scene:show

function scene:hide

function scene:destroy

???
 

If not then game.lua is not a scene and composer cannot “goto” it.

this is already added in scene4.lua i m pasting the code 

--------------------------------------------------------------------------------- -- -- scene4.lua -- --------------------------------------------------------------------------------- local composer = require( "composer" ) local scene = composer.newScene() local image, text1, text2, text3, memTimer local function onSceneTouch( self, event ) if event.phase == "began" then composer.gotoScene( "game", "slideUp", 5000 ) return true end end function scene:create( event ) local sceneGroup = self.view image = display.newImage( "b.jpg" ) image.x = display.contentCenterX image.y = display.contentCenterY sceneGroup:insert( image ) image.touch = onSceneTouch text1 = display.newText( "Sponsers", 0, 0, native.systemFontBold, 24 ) text1:setFillColor( 255 ) text1.x, text1.y = display.contentWidth \* 0.5, 50 sceneGroup:insert( text1 ) text2 = display.newText( "Please Wait ", 0, 0, native.systemFont, 16 ) text2:setFillColor( 255 ) text2.x, text2.y = display.contentWidth \* 0.5, display.contentHeight \* 0.5 sceneGroup:insert( text2 ) text3 = display.newText( "Touch to continue.", 0, 0, native.systemFontBold, 18 ) text3:setFillColor( 255 ); text3.isVisible = false text3.x, text3.y = display.contentWidth \* 0.5, display.contentHeight - 100 sceneGroup:insert( text3 ) print( "\n4: create event" ) end function scene:show( event ) local phase = event.phase if "did" == phase then print( "4: show event, phase did" ) -- remove previous scene's view composer.removeScene( "scene3" ) -- update Lua memory text display local showMem = function() image:addEventListener( "touch", image ) text3.isVisible = true text2.x = display.contentWidth \* 0.5 end memTimer = timer.performWithDelay( 1000, showMem, 1 ) end end function scene:hide( event ) local phase = event.phase if "will" == phase then print( "4: hide event, phase will\n" ) -- remove touch listener for image image:removeEventListener( "touch", image ) -- cancel timer timer.cancel( memTimer ); memTimer = nil; -- reset label text text2.text = "Successfully Loaded " end end function scene:destroy( event ) print( "((destroying scene 4's view))" ) end --------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) --------------------------------------------------------------------------------- return scene

now here i wanna go to game.lua

composer.gotoScene( “game”, “slideUp”, 5000 )
        
        return true

but the error came

No letme add and test

this is my game.lua file tell me where do i have to edit please thanks :) 

-- -- Abstract: Snooker Club -- A basic game of billiards using the physics engine -- (This is easiest to play on iPad or other large devices, but should work on all iOS and Android devices) -- -- Version: 1.3 -- -- Sample code is MIT licensed, see http://www.kamalfudda.tv -- Copyright (C) 2014-2015 Kamal Fudda Entertainment. All Rights Reserved. -- -- History -- 1.3 Changed ball file names from 1.png to ball\_1.png (for 1.png through 15.png) -- -- Supports Graphics 2.0 local composer = require( "composer" ) local scene = composer.newScene() local centerX = display.contentCenterX local centerY = display.contentCenterY local \_W = display.contentWidth local \_H = display.contentHeight local physics = require("physics") physics.start() --physics.setDrawMode("hybrid") --Set physics Draw mode physics.setScale( 60 ) -- a value that seems good for small objects (based on playtesting) physics.setGravity( 0, 0 ) -- overhead view, therefore no gravity vector display.setStatusBar( display.HiddenStatusBar ) --Constants local spriteTime = 100 -- sprite itteration time local feltColorIndex = 1 local animationStop = 1.8 -- Sprite Animation Stops Below this velocity local screenW, screenH = \_W, \_H local viewableScreenW, viewableScreenH = display.viewableContentWidth, display.viewableContentHeight --Screen Size properties local ballBody = { density=0.8, friction=1.0, bounce=.7, radius=15 } local onePlayer = 1 local twoPlayer = 2 local options = 3 --Foward Declarations local gameOver local mode --Load Audio local buzzAudio = audio.loadSound("action.mp3") local collisionAudio = audio.loadSound("ballsCollide.mp3") --Setup Splash Screen function splash() display.setDefault( "anchorX", 0.0 ) -- default to TopLeft anchor point for new objects display.setDefault( "anchorY", 0.0 ) splashGroup = display.newGroup() local splashBG = display.newImage("Match.jpg",true, 20,1,true) splashGroup:insert(splashBG) local onePlayerButton = display.newImage( "1player.png", 270, 430, true) onePlayerButton.id = onePlayer splashGroup:insert(onePlayerButton) local twoPlayerButton = display.newImage( "2player.png", 270, 480, true) twoPlayerButton.id = twoPlayer splashGroup:insert(twoPlayerButton) local optionsButton = display.newImage( "themes.png", 270, 530, true) optionsButton.id = options splashGroup:insert(optionsButton) display.setDefault( "anchorX", 0.5 ) -- restore anchor points for new objects to center anchor point display.setDefault( "anchorY", 0.5 ) local fillBot = display.newImage( "2.png", true ) fillBot.rotation=180; fillBot.x = 370; fillBot.y = -1000 splashGroup:insert(fillBot) onePlayerButton:addEventListener("touch", init) twoPlayerButton:addEventListener("touch", init) optionsButton:addEventListener("touch", init) --Buzzing Splashing screen animation function buzzLogo() local buzzGroup = display.newGroup() local randBuzz = math.random(1,6) local animationOne = 1 local animationTwo = 2 if randBuzz == animationOne then local buzzOn = display.newImage( "2.png", centerX, 75, true) buzzGroup:insert(buzzOn) audio.play(buzzAudio) timer.performWithDelay(1000, function() buzzOn:removeSelf(); end, 1) elseif randBuzz \>= animationTwo then local buzzOff = display.newImage( "2.png", centerX, 75, true) buzzGroup:insert(buzzOff) timer.performWithDelay(1000, function() buzzOff:removeSelf() end, 1) end end buzzTimer = timer.performWithDelay(400, buzzLogo, -1) --Loops buzz animation end --Setup Gameplay Stage function gameStage() stageGroup = display.newGroup() local table = display.newImage( "table\_bkg.png", true) -- "true" overrides Corona's downsizing of large images on smaller devices stageGroup:insert(table) table.x = 384 table.y = 512 local tableTopColor = display.newImage( "table"..feltColorIndex..".png", true) -- "true" overrides Corona's downsizing of large images on smaller devices stageGroup:insert(tableTopColor) tableTopColor.x = 384 tableTopColor.y = 512 local fillTop = display.newImage( "fill\_bkg.png", true ) stageGroup:insert(fillTop) fillTop.x = 384; fillTop.y = -93 local fillBot = display.newImage( "fill\_bkg.png", true ) stageGroup:insert(fillBot) fillBot.rotation=180; fillBot.x = 384; fillBot.y = 1117 local endBumperShape = { -212,-18, 212,-18, 190,2, -190,2 } local sideBumperShape = { -18,-207, 2,-185, 2,185, -18,207 } local bumperBody = { friction=0.5, bounce=0.5, shape=endBumperShape } local bumper1 = display.newImage( "bumperEnd"..feltColorIndex..".png" ) stageGroup:insert(bumper1) physics.addBody( bumper1, "static", bumperBody ) bumper1.x = 384; bumper1.y = 58 local bumper2 = display.newImage( "bumperEnd"..feltColorIndex..".png" ) stageGroup:insert(bumper2) physics.addBody( bumper2, "static", bumperBody ) bumper2.x = 384; bumper2.y = 966; bumper2.rotation = 180 -- Override the shape declaration above, but reuse the other body properties bumperBody.shape = sideBumperShape local bumper3 = display.newImage( "bumperSide"..feltColorIndex..".png" ) stageGroup:insert(bumper3) physics.addBody( bumper3, "static", bumperBody ) bumper3.x = 157; bumper3.y = 279 local bumper4 = display.newImage( "bumperSide"..feltColorIndex..".png" ) stageGroup:insert(bumper4) bumper4.x = 611; bumper4.y = 279; bumper4.rotation = 180 physics.addBody( bumper4, "static", bumperBody) local bumper5 = display.newImage( "bumperSide"..feltColorIndex..".png" ) stageGroup:insert(bumper5) physics.addBody( bumper5, "static", bumperBody ) bumper5.x = 157; bumper5.y = 745 local bumper6 = display.newImage( "bumperSide"..feltColorIndex..".png" ) stageGroup:insert(bumper6) physics.addBody( bumper6, "static", bumperBody ) bumper6.x = 611; bumper6.y = 745; bumper6.rotation = 180 pauseBtn = display.newImage("pause.png",720,0 ) pauseBtn:addEventListener("touch", function() local gameState = "paused" restartMenu(gameState) end ) if mode == onePlayer then --Setup Up Player Score Board for only one player local solidScoreBoard = display.newImage("solidScore.png") stageGroup:insert(solidScoreBoard) solidScoreBoard.y = 500; solidScoreBoard.x = 53; solidTotal = 0 solidScoreText = display.newText(solidTotal, 0, 0, native.systemFontBold, 30 ) solidScoreText:setFillColor( 0, 0, 0, 1 ) solidScoreText.x = 50; solidScoreText.y = 400; solidScoreText.rotation = 270 timer.performWithDelay(500, function() local player1 = display.newImage("player1.png") stageGroup:insert(player1) player1.y = display.contentHeight/2; player1.x = centerX; player1.alpha = 0; local player1 = transition.to( player1, { alpha= 1, time=400, x=53, y=540 } ) end ,1) elseif mode == twoPlayer then --Setup Up Player Score Board for two players local solidScoreBoard = display.newImage("solidScore.png") stageGroup:insert(solidScoreBoard) solidScoreBoard.y = 500; solidScoreBoard.x = 53; local stripeScoreBoard = display.newImage("stripeScore.png") stageGroup:insert(stripeScoreBoard) stripeScoreBoard.y = 500; stripeScoreBoard.x = 715; stripeScoreBoard.rotation = 180 solidTotal = 0 solidScoreText = display.newText(solidTotal, 0, 0, native.systemFontBold, 30 ) solidScoreText:setFillColor( 0, 0, 0, 1 ) solidScoreText.x = 50; solidScoreText.y = 400; solidScoreText.rotation = 270 stripeTotal = 0 stripeScoreText = display.newText(stripeTotal, 0, 0, native.systemFontBold, 30 ) stripeScoreText:setFillColor( 0, 0, 0, 1) stripeScoreText.x = 718; stripeScoreText.y = 602; stripeScoreText.rotation = 90 --Player one animations timer.performWithDelay(250, function() local playerOneAnimation = display.newImage("player1.png") stageGroup:insert(playerOneAnimation) playerOneAnimation.y = display.contentHeight/2 ; playerOneAnimation.x = centerX; playerOneAnimation.alpha = 0; local playerOneAnimation = transition.to( playerOneAnimation, { alpha= 1, xScale= 1, yScale=1.0, time=400, x=53, y=540 } ) end ,1) -- Player two animations timer.performWithDelay(1000, function() local playerTwoAnimation = display.newImage("player2.png") stageGroup:insert(playerTwoAnimation) playerTwoAnimation.y = display.contentHeight/2; playerTwoAnimation.x = centerX; playerTwoAnimation.alpha = 0; playerTwoAnimation.rotation = 180; local playerTwoAnimation = transition.to( playerTwoAnimation, { alpha= 1, xScale= 1, yScale=1.0, time=400, x=715, y=460 } ) end ,1) end ballProperties() end --Sets up all pool ball functions function ballProperties() gameBallGroup = display.newGroup() --Create ball group local v = 0 local reqForce = 1.18 local maxBallSounds = 4 --OnCollision Audio function ballCollisionAudio( self, event ) local force = event.force local objId = event.other.id local reqId = "spriteBall" if force \>= reqForce and reqId == objId and v \<= maxBallSounds then -- Audio Play back is determined by the amount of force audio.play(collisionAudio) v = v + 1 timer.performWithDelay(1000, function() v = v - 1 end, 1) end end --Create cueball cueball = display.newImage( "ball\_white.png" ) gameBallGroup:insert(cueball) cueball.x = centerX; cueball.y = 780 physics.addBody( cueball, ballBody ) cueball.linearDamping = 0.3 cueball.angularDamping = 0.8 cueball.isBullet = true -- force continuous collision detection, to stop really fast shots from passing through other balls cueball.type = "cueBall" cueball.collision = onCollision cueball:addEventListener("collision", cueball) -- Sprite balls start animation on Collision with cueball cueball.postCollision = ballCollisionAudio --Sets Event Listener for Audio on Collision cueball:addEventListener( "postCollision", cueball ) --Creat Rotating target target = display.newImage( "target.png" ) target.x = cueball.x; target.y = cueball.y; target.alpha = 0; --Ball Properties Table local ballTable = { {type = "solid"}, {type = "solid"}, {type = "solid"}, {type = "solid"}, {type = "solid"}, {type = "solid"}, {type = "solid"}, {type = "eightBall"}, {type = "stripe"}, {type = "stripe"}, {type = "stripe"}, {type = "stripe"}, {type = "stripe"}, {type = "stripe"}, {type = "stripe"} } local spriteInstance = {} local n = 1 for i = 1, 5 do for j = 1, (6-i) do spriteInstance[n] = display.newImage("ball\_" .. n .. ".png") gameBallGroup:insert(spriteInstance[n]) physics.addBody(spriteInstance[n], ballBody) spriteInstance[n].x = 279 + (j\*34) + (i\*15) spriteInstance[n].y = 185 + (i\*27) spriteInstance[n].linearDamping = 0.3 -- simulates friction of felt spriteInstance[n].angularDamping = 2 -- stops balls from spinning forever spriteInstance[n].isBullet = true -- If true physics body always awake spriteInstance[n].active = true -- Ball is set to active spriteInstance[n].bullet = false -- force continuous collision detection, to stop really fast shots from passing through other balls spriteInstance[n].id = "spriteBall" spriteInstance[n].type = ballTable[n].type spriteInstance[n].postCollision = ballCollisionAudio spriteInstance[n]:addEventListener( "postCollision", spriteInstance[n] ) n = n + 1 end end cueball:addEventListener( "touch", cueShot ) -- Sets event listener to cueball setPockets() end --Reset cueball function resetCueball() cueball.alpha = 0 cueball.x = 384 cueball.y = 780 cueball.xScale = 2.0; cueball.yScale = 2.0 local dropBall = transition.to( cueball, { alpha=1.0, xScale=1.0, yScale=1.0, time=400 } ) end --Sets up pockets function inPocket( self, event ) local fallDown = transition.to( event.other, { alpha=0, xScale=0.3, yScale=0.3, time=200 } ) local object = event.other event.other:setLinearVelocity( 0, 0 ) if event.other.type == "cueBall" then timer.performWithDelay( 50, resetCueball ) elseif event.other.type == "solid" and event.other.active == true then event.other.active = false --Update Solid Score solidTotal = solidTotal + 1 solidScoreText.text = solidTotal elseif event.other.type == "stripe" and event.other.active == true and mode == 2 then event.other.active = false -- Prevents balls from --Update Stripe Score stripeTotal = stripeTotal + 1 stripeScoreText.text = stripeTotal elseif event.other.type == "eightBall" then gameOver() end end -- Create pockets function setPockets() local pocket = {} for i = 1, 3 do for j = 1, 2 do local index = j + ((i-1) \* 2) -- a counter from 1 to 6 -- Add objects to use as collision sensors in the pockets local sensorRadius = 20 pocket[index] = display.newCircle( -389 + (515\*j), -436 + (474\*i), sensorRadius ) stageGroup:insert(pocket[index]) -- (Change this value to "true" to make the pocket sensors visible) pocket[index].isVisible = false physics.addBody( pocket[index], { radius=sensorRadius, isSensor=true } ) pocket[index].id = "pocket" pocket[index].bullet = false pocket[index].collision = inPocket pocket[index]:addEventListener( "collision", pocket[index] ) -- add table listener to each pocket sensor end end end -- Shoot the cue ball, using a visible force vector function cueShot( event ) local t = event.target local phase = event.phase if "began" == phase then display.getCurrentStage():setFocus( t ) t.isFocus = true -- Stop current cueball motion, if any t:setLinearVelocity( 0, 0 ) t.angularVelocity = 0 target.x = t.x target.y = t.y startRotation = function() target.rotation = target.rotation + 4 end Runtime:addEventListener( "enterFrame", startRotation ) local showTarget = transition.to( target, { alpha=0.4, xScale=0.4, yScale=0.4, time=200 } ) myLine = nil elseif t.isFocus then if "moved" == phase then if ( myLine ) then myLine.parent:remove( myLine ) -- erase previous line, if any end myLine = display.newLine( t.x,t.y, event.x,event.y ) myLine:setStrokeColor( 1, 1, 1, 50/255 ) myLine.strokeWidth = 15 elseif "ended" == phase or "cancelled" == phase then display.getCurrentStage():setFocus( nil ) t.isFocus = false local stopRotation = function() Runtime:removeEventListener( "enterFrame", startRotation ) end local hideTarget = transition.to( target, { alpha=0, xScale=1.0, yScale=1.0, time=200, onComplete=stopRotation } ) if ( myLine ) then myLine.parent:remove( myLine ) end -- Strike the ball! local cueShot = audio.loadSound("cueShot.mp3") audio.play(cueShot) t:applyForce( (t.x - event.x), (t.y - event.y), t.x, t.y ) end end return true -- Stop further propagation of touch event end --Displays game over screeen function gameOver() gameOverGroup = display.newGroup() local overSplash = display.newImage( "game\_over.png", centerX, centerY, true ) gameOverGroup:insert(overSplash) overSplash.alpha = 0 overSplash.xScale = 1.5; overSplash.yScale = 1.5 local showGameOver = transition.to( overSplash, { alpha=1.0, xScale=1.0, yScale=1.0, time=500 } ) cueball:removeEventListener( "touch", cueShot ) local gameState = "gameOver" restartMenu(gameState) end --In game restart menu function restartMenu(gameState) pauseBtn:removeSelf() menuGroup = display.newGroup() if gameState == "paused" then local backDrop = display.newRect(0, 0, screenW, screenH ) backDrop.anchorX = 0 backDrop.anchorY = 0 menuGroup:insert(backDrop) backDrop:setFillColor(0, 0, 0,100/255) end local restartGameImage = display.newImage("newgame.png",centerX,centerY,true ) menuGroup:insert(restartGameImage) restartGameImage.state = gameState restartGameImage:addEventListener('touch', restartGame) end --Restart Game function restartGame( event ) local gameState = event.target.state if event.phase == "ended" then if gameState == "gameOver" then gameOverGroup:removeSelf() end stageGroup:removeSelf() -- Removes All Stage Objects gameBallGroup:removeSelf() --Removes Ball Objects menuGroup:removeSelf() --Removes Menu Group Objects timer.performWithDelay(1000, splash, 1) -- Calls splash screen end end --Displays options menu function optionMenu() local stroke = 5 local optionsGroup = display.newGroup() --Create options menu group local function changeFelt(event) local feltObject = event.target local feltColor = event.target.id if event.phase == "ended" then feltColorIndex = feltColor feltObject.selected = true optionsGroup:removeSelf() feltObject:setStrokeColor(16/255, 1, 4/255) timer.performWithDelay(200, function() transition.to( splashGroup, { alpha= 1, xScale= 1, yScale=1.0, time=1000} ) end ,1) end end display.setDefault( "anchorX", 0.0 ) -- default to TopLeft anchor point for new objects display.setDefault( "anchorY", 0.0 ) local optionsBG = display.newImage("themes.png",280,540,true) optionsGroup:insert(optionsBG) local greenFelt = display.newImage( "sample1.png", 49, 701, true ) optionsGroup:insert(greenFelt) greenFelt:setStrokeColor(1) greenFelt.strokeWidth = stroke greenFelt.id = "1" greenFelt:addEventListener('touch', changeFelt) local purpleFelt = display.newImage( "sample2.png", 219, 701, true ) optionsGroup:insert(purpleFelt) purpleFelt:setStrokeColor(1) purpleFelt.strokeWidth = stroke purpleFelt.id = "2" purpleFelt:addEventListener('touch', changeFelt) local redFelt = display.newImage( "sample3.png", 392, 701, true ) optionsGroup:insert(redFelt) redFelt:setStrokeColor(1) redFelt.strokeWidth = stroke redFelt.id = "3" redFelt:addEventListener('touch', changeFelt) local tealFelt = display.newImage( "sample4.png", 565, 701, true ) optionsGroup:insert(tealFelt) tealFelt:setStrokeColor(1) tealFelt.strokeWidth = stroke tealFelt.id = "4" tealFelt:addEventListener('touch', changeFelt) local selectFeltText = display.newText("Select a table color!", 150, 625, systemFontBold, 50 ) optionsGroup:insert(selectFeltText) selectFeltText:setFillColor(1,1,1) display.setDefault( "anchorX", 0.5 ) -- restore anchor points for new objects to center anchor point display.setDefault( "anchorY", 0.5 ) end function init( event ) mode = event.target.id if mode == onePlayer or mode == twoPlayer then timer.cancel(buzzTimer)-- Remoes buzzing animation splashGroup:removeSelf()-- Removes splash screen objects timer.performWithDelay(800, gameStage, 1) elseif mode == options then local splashButtonAnimation = transition.to( splashGroup, { alpha= 0, xScale= 1, yScale=1.0, time=400} ) -- Transitions splash Menu to options Menu optionMenu() end end function scene:create( event ) local sceneGroup = self.view image = display.newImage( "b.jpg" ) image.x = display.contentCenterX image.y = display.contentCenterY sceneGroup:insert( image ) image.touch = onSceneTouch text1 = display.newText( "Sponsers", 0, 0, native.systemFontBold, 24 ) text1:setFillColor( 255 ) text1.x, text1.y = display.contentWidth \* 0.5, 50 sceneGroup:insert( text1 ) text2 = display.newText( "Please Wait ", 0, 0, native.systemFont, 16 ) text2:setFillColor( 255 ) text2.x, text2.y = display.contentWidth \* 0.5, display.contentHeight \* 0.5 sceneGroup:insert( text2 ) text3 = display.newText( "Touch to continue.", 0, 0, native.systemFontBold, 18 ) text3:setFillColor( 255 ); text3.isVisible = false text3.x, text3.y = display.contentWidth \* 0.5, display.contentHeight - 100 sceneGroup:insert( text3 ) print( "\n4: create event" ) end function scene:show( event ) local phase = event.phase if "did" == phase then print( "4: show event, phase did" ) -- remove previous scene's view composer.removeScene( "scene3" ) -- update Lua memory text display local showMem = function() image:addEventListener( "touch", image ) text3.isVisible = true text2.x = display.contentWidth \* 0.5 end memTimer = timer.performWithDelay( 1000, showMem, 1 ) end end function scene:hide( event ) local phase = event.phase if "will" == phase then print( "4: hide event, phase will\n" ) -- remove touch listener for image image:removeEventListener( "touch", image ) -- cancel timer timer.cancel( memTimer ); memTimer = nil; -- reset label text text2.text = "Successfully Loaded " end end function scene:destroy( event ) print( "((destroying scene 4's view))" ) end --------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) return scene -- Set Up Splashh Screen splash() --Sets game splash button listeners return scene

First these lines need to go.  They never get executed since the return scene above them ends the module.

– Set Up Splashh Screen
splash()

–Sets game splash button listeners

return scene

Now it looks like to me, that you need to spend some time thinking about how the sample app works and how it should be implemented in a scene.  For instance. the function splash() that you’re trying to call at the end, seems to me like it should be it’s own scene, a “splash.lua” where you have a valid scene file and the code inside the splash() function would be in the scene:create() function of the splash.lua.

When you have a standalone main.lua, like our sample apps are for the most part, calling splash() creates a temporary screen that you tap away and then it starts up the game code.  In a scene managed app, main.lua would call the splash scene.  When the splash scene ends (someone taps on something or its done on a timer after a few seconds), it would go to game.lua (or more likely a menu.lua, but lets say we go straight to the game.

With scenes, the scene:create() runs the code that draws the scene on the screen.  scene:show() runs the code to start the game play.  You have to figure out how to take all of that code (now in your game.lua) and put the right parts in scene:create() and the right parts in scene:show() to trigger all of the other functions needed to play the game.

Rob

I m confused and having headache too what do u mean by put the right part in scene create ? do u mean i just need to put  this code in game.lua ? 

function scene:create( event ) local sceneGroup = self.view image = display.newImage( "b.jpg" ) image.x = display.contentCenterX image.y = display.contentCenterY sceneGroup:insert( image ) image.touch = onSceneTouch text1 = display.newText( "Sponsers", 0, 0, native.systemFontBold, 24 ) text1:setFillColor( 255 ) text1.x, text1.y = display.contentWidth \* 0.5, 50 sceneGroup:insert( text1 ) text2 = display.newText( "Please Wait ", 0, 0, native.systemFont, 16 ) text2:setFillColor( 255 ) text2.x, text2.y = display.contentWidth \* 0.5, display.contentHeight \* 0.5 sceneGroup:insert( text2 ) text3 = display.newText( "Touch to continue.", 0, 0, native.systemFontBold, 18 ) text3:setFillColor( 255 ); text3.isVisible = false text3.x, text3.y = display.contentWidth \* 0.5, display.contentHeight - 100 sceneGroup:insert( text3 ) print( "\n4: create event" ) end function scene:show( event ) local phase = event.phase if "did" == phase then print( "4: show event, phase did" ) -- remove previous scene's view composer.removeScene( "scene3" ) -- update Lua memory text display local showMem = function() image:addEventListener( "touch", image ) text3.isVisible = true text2.x = display.contentWidth \* 0.5 end memTimer = timer.performWithDelay( 1000, showMem, 1 ) end end function scene:hide( event ) local phase = event.phase if "will" == phase then print( "4: hide event, phase will\n" ) -- remove touch listener for image image:removeEventListener( "touch", image ) -- cancel timer timer.cancel( memTimer ); memTimer = nil; -- reset label text text2.text = "Successfully Loaded " end end function scene:destroy( event ) print( "((destroying scene 4's view))" ) end ---------------------------------------------------------------------------------

or what if yes then i put this and nothing happen touch button not working … can u give me sample code what should i put in game.lua or scene4.lua to move the scene to game.lua after scene4.lua finish his work thanks and please sir i request u

Sample apps like simple pool are not built in the same way Scene Managed apps are.  In the case of SimplePool, all the code is in main.lua.  It shows a splash screen which is really a menu screen.  When you interact with the buttons then the menu goes away and you can play the game.   The main.lua is put together with a bunch of functions that start with a function called splash().

In a scene managed app, the mentality about how code is organized and executed is different.  Different parts are in different scene files.  In this case, there are two screens:  The Menu (splash) and the game.  I would also consider a 3rd scene for settings, though in the sample app the settings are part of splash.

Because you want the scene manager to actually manage your objects, one of the key parts to make this work is taking advantage of inserting your graphics (display objects) into the scene’s “view” group.  This lets Composer transition things on and off screen.  It lets the Composer free up memory when needed for you.  For this to happen, you have to use the scene’s event functions:

scene:create

scene:show

scene:hide and

scene:destroy

You basically have to put any calls to display.newImage(), display.newImageRect(), display.newText(), widget.newButton, etc inside of scene:create for things that make up the scene.   Dynamic things that need spawned later can be done in scene:show.

Personally, trying to put SimplePool into a Composer based app might be a but much to try and learn from.  Perhaps taking something like hello physics and making it into a scene so you can learn what has to go where and then work up to Simple Pool.

so would u suggest any easy way to make scene transition instead of using composer ? what i need is 

Banner or name of my game along with ads >> game name along with ads >> developed by along with ads >> pool game main menu if u have easy way lemme know thx

Composer is the way to go, but it’s going to take some time and patience to learn.

Rob

having very had time Mr rob i ll be happy if you adjust the game.lua code yourself or atleast give proper tutorial i m trying since few hour and fail else i 'd have to quit the corona sdk which i dont want to do so please help and paste simple code to put in game.lua

Here’s a list of Corona tutorials and resourses. Here is the CoronaLabs tutorial for Composer, and here are some tutorial videos that people seem to be big fans of. I don’t endorse them as I haven’t used them, but if you’re willing to drop money on a Pro subscription and then threaten to stop using that paid subscription within 1 thread, I’m going to assume you’ll be willing to spend money on the tutorial videos.

if i m not wrong those video are on youtube right ?

  • i know how composer works but as ROB Says Simple pool and composer are using different coding so its hard for me to understand can u update my game.lua code ? if yes i might willing to pay u and i threat to stop using corona because i didnot get any positive response either in admov and either here corona sdk is getting harder for me because of following
  1. some template use graphics 1 and some template using graphics 2 so obiviously all coding style also being changed

  2. some plugin / coding gave error after wasting 200 hour got nothing 

Some people sell tutorials.  Others are free.  Some Tutorials are still based on Graphics 1.  All of ours should be around Graphics 2.0 and free.  They are here:  http://coronalabs.com/resources/tutorials/getting-started-with-corona/

As far as this issue, programming isn’t cut and paste.  It isn’t taking another project and modifying it.  You can’t take two different projects and expect them to magically go together too.  This takes work and some thinking.

Be patient.  Take time to learn how the code works.  Take the time to learn how Composer works.  Start with a smaller project like Hello Physics and then move up to something with more functions and you will eventually get to the Pool game.

Rob