Cannot exit scene to another on device

Hello,

I have a new problem with my game scene. It runs find in the simulator and also reloads like needed. But when I click a button to go to exit the game and go to another scene it works in the simulator but not my device. I am using a Samsung Galaxy S2 phone. All of the other scenes in the app go es to others. But my game does not exit. It just locks up. I know the exitScene is being called because it removes the objects in that function. Can anyone see what would be causing this? If someone needs the Main and Home files I can include them so you can run it and see yourself. I was hoping someone would see in the code. btnNextScene is the button for leaving the game scene and nextScene is the function being called for it.

Thanks!!

---------------------------------------------------------------------------------- -- -- scenetemplate.lua -- ---------------------------------------------------------------------------------- local storyboard = require( "storyboard" ) storyboard.removeAll() local scene = storyboard.newScene() storyboard.purgeScene( "sceneGame" ) ---------------------------------------------------------------------------------- -- -- NOTE: -- -- Code outside of listener functions (below) will only be executed once, -- unless storyboard.removeScene() is called. -- --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- -- BEGINNING OF YOUR IMPLEMENTATION --------------------------------------------------------------------------------- -- Your code here local widget = require "widget" local m1 = 0 local physics = require("physics") physics.start() physics.setScale(50) physics.setGravity(9.8,0) --physics.setDrawMode( "hybrid" ) local score = 0 local cframe = 1 local t = {} local D2 = .4 local B2 = .2 local Y5 = 0 local P3 = 0 local P4 = 0 local R2 = math.random(5) if R2 == 0 then D2 = .27 B2 = .5 Y5 = -15 end if R2 == 1 then D2 = .31 B2 = .13 Y5 = -10 end if R2 == 2 then D2 = .35 B2 = .2 Y5 = 0 end if R2 == 3 then D2 = .4 B2 = .27 Y5 = 10 end if R2 == 4 then D2 = .45 B2 = .33 Y5 = 13 end if R2 == 5 then D2 = .5 B2 = .4 Y5 = 17 end local x1 = 172 local y1 = 0 local x2 = 130 local y2 = 200 local x3 = 90 local y3 = 190 local x4 = 50 local y4 = 175 local x5 = 10 local x6 = -30 y1 = y1 - 600 + Y5 y2 = y2 - 600 + Y5 y3 = y3 - 600 + Y5 y4 = y4 - 600 + Y5 -- HELP!!! The storyboard.reloadScene() is not working here. The print() is but why not the reload? local function onbtnPlayAgainEvent( event ) local phase = event.phase if "ended" == phase then storyboard.purgeScene( "sceneGame" ) storyboard.reloadScene() end end local function nextScene( event ) if event.phase == "ended" then storyboard.gotoScene( "sceneHome" ) storyboard.purgeScene( "sceneGame" ) end end local back1 local shoe local game local cowboy local hay local onCollision local listener = {} function listener:timer( event ) --print( "listener called" ) if game.y \> 20 then game.y = game.y - 11 end end function loop(e) local targetx = 300 - shoe.y if shoe.y \< 200 then local d = (game.y - (shoe.y - 200) ) d = d - game.y if game.y \< 950 then game.y = d end end end function scene:createScene( event ) game = display.newGroup() score = 0 cframe = 1 t = {} D2 = .4 B2 = .2 Y5 = 0 P3 = 0 P4 = 0 R2 = math.random(5) if R2 == 0 then D2 = .27 B2 = .5 Y5 = -15 end if R2 == 1 then D2 = .31 B2 = .13 Y5 = -10 end if R2 == 2 then D2 = .35 B2 = .2 Y5 = 0 end if R2 == 3 then D2 = .4 B2 = .27 Y5 = 10 end if R2 == 4 then D2 = .45 B2 = .33 Y5 = 13 end if R2 == 5 then D2 = .5 B2 = .4 Y5 = 17 end x1 = 172 y1 = 0 x2 = 130 y2 = 200 x3 = 90 y3 = 190 x4 = 50 y4 = 175 x5 = 10 x6 = -30 y1 = y1 - 600 + Y5 y2 = y2 - 600 + Y5 y3 = y3 - 600 + Y5 y4 = y4 - 600 + Y5 back1 = display.newImage( "gfx/landbackground.jpg",0,-1500) local floor = display.newImage( "gfx/landfloor.jpg",275,-1500) physics.addBody(floor, "static" , {density = 1.0, friction = 0.3, bounce = 0.2, isSensor = false}) floor.myName = "floor" t[#t+1] = floor hay = display.newImage( "gfx/hay1.png",x1,y1) physics.addBody(hay, "dynamic", {density = 1.0, friction = 0.3, bounce = 0.2, isSensor = false}) hay.myName = "hay" local barn = display.newImage( "gfx/barn.png",10,-1200) physics.addBody(barn, "static", {density = 1.0, friction = 0.3, bounce = 0.2, isSensor = false}) barn.myName = "barn" t[#t+1] = barn cowboy = display.newImage( "gfx/cowboy1h.png",80,280) shoe = display.newImage( "gfx/shoe1.png",186,287) shoe.myName = "shoe" shoe.isVisible = false game:insert(floor) game:insert(back1) game:insert(cowboy) game:insert(hay) game:insert(barn) game:insert(shoe) game.y = 1250 --game.y = 25 timer.performWithDelay( 5, listener, 210 ) local cans = math.random(1,3) if cans == 1 then local can1 = display.newImage( "gfx/beercan1.png",x2,y2) physics.addBody(can1, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can1.myName = "can1" y2 = y2 - 30 game:insert(can1) local can2 = display.newImage( "gfx/beercan1.png",x2,y2) physics.addBody(can2, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can2.myName = "can2" y2 = y2 - 30 game:insert(can2) local can3 = display.newImage( "gfx/beercan1.png",x2,y2) physics.addBody(can3, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can3.myName = "can3" y2 = y2 - 30 game:insert(can3) local can4 = display.newImage( "gfx/beercan1.png",x2,y2) physics.addBody(can4, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can4.myName = "can4" y2 = y2 - 30 game:insert(can4) local can5 = display.newImage( "gfx/beercan1.png",x2,y2) physics.addBody(can5, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can5.myName = "can5" y2 = y2 - 30 game:insert(can5) local can6 = display.newImage( "gfx/beercan1.png",x2,y2) physics.addBody(can6, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can6.myName = "can6" game:insert(can6) local can7 = display.newImage( "gfx/beercan1.png",x3,y3) physics.addBody(can7, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can7.myName = "can7" y3 = y3 - 30 game:insert(can7) local can8 = display.newImage( "gfx/beercan1.png",x3,y3) physics.addBody(can8, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can8.myName = "can8" y3 = y3 - 30 game:insert(can8) local can9 = display.newImage( "gfx/beercan1.png",x3,y3) physics.addBody(can9, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can9.myName = "can9" y3 = y3 - 30 game:insert(can9) local can10 = display.newImage( "gfx/beercan1.png",x3,y3) physics.addBody(can10, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can10.myName = "can10" y3 = y3 - 30 game:insert(can10) local can11 = display.newImage( "gfx/beercan1.png",x3,y3) physics.addBody(can11, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can11.myName = "can11" game:insert(can11) local can12 = display.newImage( "gfx/beercan1.png",x4,y4) physics.addBody(can12, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can12.myName = "can12" y4 = y4 - 30 game:insert(can12) local can13 = display.newImage( "gfx/beercan1.png",x4,y4) physics.addBody(can13, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can13.myName = "can13" y4 = y4 - 30 game:insert(can13) local can14 = display.newImage( "gfx/beercan1.png",x4,y4) physics.addBody(can14, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can14.myName = "can14" y4 = y4 - 30 game:insert(can14) local can15 = display.newImage( "gfx/beercan1.png",x4,y4) physics.addBody(can15, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can15.myName = "can15" game:insert(can15) t[#t+1] = can1 t[#t+1] = can2 t[#t+1] = can3 t[#t+1] = can4 t[#t+1] = can5 t[#t+1] = can6 t[#t+1] = can7 t[#t+1] = can8 t[#t+1] = can9 t[#t+1] = can10 t[#t+1] = can11 t[#t+1] = can12 t[#t+1] = can13 t[#t+1] = can14 t[#t+1] = can15 end if cans == 2 then y2 = y2 + 10 y3 = y3 + 10 y4 = y4 + 10 local can1 = display.newImage( "gfx/beercan1.png",x2,y2) physics.addBody(can1, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can1.myName = "can1" game:insert(can1) local can3 = display.newImage( "gfx/beercan1.png",x3,y2) physics.addBody(can3, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can3.myName = "can3" y2 = y2 - 30 game:insert(can3) local can2 = display.newImage( "gfx/beercan1.png",x2,y2) physics.addBody(can2, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can2.myName = "can2" game:insert(can2) local can4 = display.newImage( "gfx/beercan1.png",x3,y2) physics.addBody(can4, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can4.myName = "can4" game:insert(can4) local can5 = display.newImage( "gfx/beercan1.png",x4,y3) physics.addBody(can5, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can5.myName = "can5" game:insert(can5) y2 = y2 - 35 y3 = y3 - 65 local can6 = display.newImage( "gfx/beercan1.png",x2,y2) physics.addBody(can6, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can6.myName = "can6" game:insert(can6) local can7 = display.newImage( "gfx/beercan1.png",x3,y2) physics.addBody(can7, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can7.myName = "can7" y2 = y2 - 30 game:insert(can7) local can8 = display.newImage( "gfx/beercan1.png",x2,y2) physics.addBody(can8, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can8.myName = "can8" game:insert(can8) local can9 = display.newImage( "gfx/beercan1.png",x3,y2) physics.addBody(can9, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can9.myName = "can9" game:insert(can9) local can10 = display.newImage( "gfx/beercan1.png",x4,y3) physics.addBody(can10, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can10.myName = "can10" game:insert(can10) y2 = y2 - 35 y3 = y3 - 65 local can11 = display.newImage( "gfx/beercan1.png",x2,y2) physics.addBody(can11, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can11.myName = "can11" game:insert(can11) local can12 = display.newImage( "gfx/beercan1.png",x3,y2) physics.addBody(can12, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can12.myName = "can12" y2 = y2 - 30 game:insert(can12) local can13 = display.newImage( "gfx/beercan1.png",x2,y2) physics.addBody(can13, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can13.myName = "can13" game:insert(can13) local can14 = display.newImage( "gfx/beercan1.png",x3,y2) physics.addBody(can14, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can14.myName = "can14" game:insert(can14) local can15 = display.newImage( "gfx/beercan1.png",x4,y3) physics.addBody(can15, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can15.myName = "can15" game:insert(can15) t[#t+1] = can1 t[#t+1] = can2 t[#t+1] = can3 t[#t+1] = can4 t[#t+1] = can5 t[#t+1] = can6 t[#t+1] = can7 t[#t+1] = can8 t[#t+1] = can9 t[#t+1] = can10 t[#t+1] = can11 t[#t+1] = can12 t[#t+1] = can13 t[#t+1] = can14 t[#t+1] = can15 end if cans == 3 then y2 = y2 - 10 y3 = y3 - 13 y4 = y4 - 10 local can1 = display.newImage( "gfx/beercan1.png",x2,y2) physics.addBody(can1, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can1.myName = "can1" y2 = y2 - 30 game:insert(can1) local can2 = display.newImage( "gfx/beercan1.png",x2,y2) physics.addBody(can2, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can2.myName = "can2" y2 = y2 - 30 game:insert(can2) local can3 = display.newImage( "gfx/beercan1.png",x2,y2) physics.addBody(can3, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can3.myName = "can3" y2 = y2 - 30 game:insert(can3) local can4 = display.newImage( "gfx/beercan1.png",x2,y2) physics.addBody(can4, "dynamic", {density = D2, friction = 0.3, bounce = 0.2}) can4.myName = "can4" game:insert(can4) y2 = y2 + 90 local can5 = display.newImage( "gfx/beercan1.png",x3,y2) physics.addBody(can5, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can5.myName = "can5" y2 = y2 - 30 game:insert(can5) local can6 = display.newImage( "gfx/beercan1.png",x3,y2) physics.addBody(can6, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can6.myName = "can6" y2 = y2 - 30 game:insert(can6) local can7 = display.newImage( "gfx/beercan1.png",x3,y2) physics.addBody(can7, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can7.myName = "can7" y2 = y2 - 30 game:insert(can7) local can8 = display.newImage( "gfx/beercan1.png",x3,y2) physics.addBody(can8, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can8.myName = "can8" y2 = y2 - 30 game:insert(can8) local can9 = display.newImage( "gfx/beercan1.png",x4,y3) physics.addBody(can9, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can9.myName = "can9" y3 = y3 - 30 game:insert(can9) local can10 = display.newImage( "gfx/beercan1.png",x4,y3) physics.addBody(can10, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can10.myName = "can10" y3 = y3 - 30 game:insert(can10) local can11 = display.newImage( "gfx/beercan1.png",x4,y3) physics.addBody(can11, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can11.myName = "can11" game:insert(can11) local can12 = display.newImage( "gfx/beercan1.png",x5,y4) physics.addBody(can12, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can12.myName = "can12" y4 = y4 - 30 game:insert(can12) local can13 = display.newImage( "gfx/beercan1.png",x5,y4) physics.addBody(can13, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can13.myName = "can13" game:insert(can13) y3 = y3 + 30 local can14 = display.newImage( "gfx/beercan1.png",x6,y3) physics.addBody(can14, "dynamic", {density =D2, friction = 0.3, bounce = 0.2}) can14.myName = "can14" game:insert(can14) t[#t+1] = can1 t[#t+1] = can2 t[#t+1] = can3 t[#t+1] = can4 t[#t+1] = can5 t[#t+1] = can6 t[#t+1] = can7 t[#t+1] = can8 t[#t+1] = can9 t[#t+1] = can10 t[#t+1] = can11 t[#t+1] = can12 t[#t+1] = can13 t[#t+1] = can14 end text1 = display.newText( "", 20, 50, native.systemFontBold, 28 ) text1:setTextColor( 0 ) text1:rotate(270) --game:insert(text1) self.view = game back1:addEventListener("touch", shoeTouched) Runtime:addEventListener("enterFrame", loop) Runtime:addEventListener( "collision", onCollision ) end --createScene -- Called BEFORE scene has moved onscreen: function scene:willEnterScene(event) local group = self.view end local createButton = false local function timerclistener( event ) print( "listener called" ) local FL = 0 for i = 1, #t do local vx, vy = t[i]:getLinearVelocity() if vx \> 4 then FL = vx end if vx \< -4 then FL = vx end if vy \> 4 then FL = vy end if vy \< -4 then FL = vy end end if FL == 0 and createButton == false then createButton = true btnPlayAgain = widget.newButton { left = 100, top = 10, width = 230, height = 60, label = "Play Again", fontSize = 14, id = "button\_1", onEvent = onbtnPlayAgainEvent, } btnNextScene = widget.newButton { left = 100, top = 100, width = 230, height = 60, label = "Next Scene", fontSize = 14, id = "button\_2", onEvent = nextScene, } end end local cowboythrowlistener = {} function cowboythrowlistener:timer( event ) cframe = cframe - 1 if cframe == 1 then cowboy:removeSelf() cowboy = display.newImage( "gfx/cowboy1h.png",80,280) game:insert(cowboy) cframe = 1 -- Throw horseshoe now shoe.isVisible = true physics.addBody(shoe, "dynamic", {density =3.2, friction = 0.3, bounce = 0.2}) shoe:applyLinearImpulse(P3, P4, shoe.x, shoe.y) display.getCurrentStage():setFocus(nil) cowboy:removeSelf() cowboy = display.newImage( "gfx/cowboy0.png",80,280) game:insert(cowboy) t[#t+1] = shoe end if cframe == 2 then cowboy:removeSelf() cowboy = display.newImage( "gfx/cowboy2h.png",80,280) game:insert(cowboy) cframe = 2 end if cframe == 3 then cowboy:removeSelf() cowboy = display.newImage( "gfx/cowboy3h.png",80,280) game:insert(cowboy) cframe = 3 end if cframe == 4 then cowboy:removeSelf() cowboy = display.newImage( "gfx/cowboy4h.png",80,280) game:insert(cowboy) cframe = 4 end if cframe == 5 then cowboy:removeSelf() cowboy = display.newImage( "gfx/cowboy5h.png",80,280) game:insert(cowboy) cframe = 5 end end function shoeTouched(event) if event.phase == "began" then display.getCurrentStage():setFocus(back1) elseif event.phase == "moved" then --print(event.x ..event.y) if event.y \> 300 and event.y \< 351 then cowboy:removeSelf() cowboy = display.newImage( "gfx/cowboy1h.png",80,280) game:insert(cowboy) cframe = 1 end if event.y \> 350 and event.y \< 371 then cowboy:removeSelf() cowboy = display.newImage( "gfx/cowboy2h.png",80,280) game:insert(cowboy) cframe = 2 end if event.y \> 370 and event.y \< 386 then cowboy:removeSelf() cowboy = display.newImage( "gfx/cowboy3h.png",80,280) game:insert(cowboy) cframe = 3 end if event.y \> 385 and event.y \< 407 then cowboy:removeSelf() cowboy = display.newImage( "gfx/cowboy4h.png",80,280) game:insert(cowboy) cframe = 4 end if event.y \> 406 and event.y \< 425 then cowboy:removeSelf() cowboy = display.newImage( "gfx/cowboy5h.png",80,280) game:insert(cowboy) cframe = 5 end if event.y \> 424 and event.y \< 480 then cowboy:removeSelf() cowboy = display.newImage( "gfx/cowboy6h.png",80,280) game:insert(cowboy) cframe = 6 end elseif event.phase == "ended" then local p1 = event.xStart - event.x local p2 = event.yStart - event.y if p1 \> 20 then p1 = 20 end if p1 \< -17 then p1 = -17 end if p2 \> 10 then p2 = 10 end if p2 \< -30 then p2 = -30 end P3 = p1 P4 = p2 timer.performWithDelay( 50, cowboythrowlistener, 7 ) --physics.addBody(shoe, "dynamic", {density =3.2, friction = 0.3, bounce = 0.2}) --shoe:applyLinearImpulse(p1, p2, shoe.x, shoe.y) --display.getCurrentStage():setFocus(nil) end end --[[local function onCollision( event ) if ( event.phase == "began" ) then --print( event.object2.myName ) end end Runtime:addEventListener( "collision", onCollision ) --]] local time onCollision = function ( event ) if ( event.phase == "ended" ) then -- print( "began: " .. event.object1.myName .. " & " .. event.object2.myName ) time = timer.performWithDelay( 1000, timerclistener,1 ) local item1 = event.object1.myName local item2 = event.object2.myName if item1:sub(1,5) == "floor" then if item2:sub(1,3) == "can" then local R3 = math.random(75,125) score = score + R3 text1.text = "Score: " .. score --storyboard.reloadScene() --print(score) end end if item1:sub(1,3) == "hay" then if item2:sub(1,3) == "can" then print( "holaa" ) local R3 = math.random(75,125) score = score + R3 text1.text = "Score: " .. score --print(score) end end end end --timer.performWithDelay( 5, listener, 210 ) --Runtime:addEventListener( "collision", onCollision ) -- Called when scene is about to move offscreen: function scene:exitScene( event ) Runtime:removeEventListener("enterFrame", loop) Runtime:removeEventListener( "collision", onCollision ) timer.cancel( time ) display.remove( text1 ) text1 = nil display.remove( btnPlayAgain ) btnPlayAgain = nil display.remove( btnNextScene ) btnNextScene = nil createButton = false --storyboard.purgeScene("sceneGame") end function scene:reloadScene( event ) --createButton = false --storyboard.purgeScene("sceneGame") end -- Called when scene is about to move offscreen: --[[function scene:exitScene(event) local group = self.view end--]] -- Called AFTER scene has finished moving offscreen: --[[function scene:didExitScene(event) local group = self.view end--]] -- Called prior to the removal of scene's "view" (display group) function scene:destroyScene(event) local group = self.view end -- "exitScene" event is dispatched before next scene's transition begins --scene:addEventListener( "exitScene", scene ) -- "createScene" event is dispatched if scene's view does not exist scene:addEventListener( "createScene", scene ) scene:addEventListener( "enterScene", scene ) scene:addEventListener( "exitScene", scene) scene:addEventListener( "reloadScene", scene ) scene:addEventListener( "didExitScene", scene) scene:addEventListener( "destroyScene", scene) --------------------------------------------------------------------------------- return scene

Often when something works in the simulator but not on your device, it’s because file names are case-sensitive on the device but not on the simulator.

Have you inspected the log output from your device to see if it reports any errors?  See tip #5 on this blog post for some info how to see it: http://www.coronalabs.com/blog/2012/09/26/faq-wednesday-ios-builds-api-docs-and-android/

  • Andrew

Thanks. I double checked and everything is good there. I made sure the names of the scene it calls matches the case of the actual file. Still locks up…

Well, it wouldn’t necessarily be just the name of the scene matching, but any file that the scene accesses (e.g., images that it loads).

Also, when you said “everything is good there”, did you mean you checked adb logcat, and you saw no error messages?

  • Andrew

Sorry but what is the adb logcat? I checked the output simulator and nothing there. Any image files I use are already loaded and used by the time I try to exit the game. I play one level and then I show two buttons. One to play again and one to exit the game. The play again works. and all the exit goes is try to go to another scene which is the previous (sceneHome) and it locks before getting there.

adb logcat is a part of the Android SDK that lets you see the logs on your device.  In the Corona Simulator, when your app uses print(), it shows in the Corona Simulator Output window.  Likewise, on Android, it shows in the device log, which you can view using adb logcat.  If you’ve never used it before, it’s critical that you give it a try, since most likely you’ll see an error message that will point you to whatever the problem is.

  • Andrew

Thanks, this will probably be helpful once I learn how to use it. I’m googling the name now to see what I need to do to use it with Windows and my phone.

I installed CatLog and ran the my app with it but I really could not follow the log too much and did not see anything that stood out for me. I’ll be glad to even pay someone if they can fix it. Let me know and I’ll email you the code.

Thanks!

I still cannot find why this scene will not exit. I do not think it is related to the device or to any case-sensitive typos because everything is already loaded before I try to exit the scene. And I can exit any of the other scenes. This is the only one that is a game scene though. If anyone sees what can cause this please let me know. Again, I will even pay for the solution. I have been stuck for two weeks now. Source code to the scene is above. Let me know if you want the entire project to look at.

Thanks!

I just want to double check.  Your scene file name is  sceneHome.lua and sceneGame.lua, not scenehome.lua or scenegame.lua?

I don’t know about the CatLog command, but if you used the “adb logcat” tool, you can put a qualifier on the end:

adb logcat Corona:v *:s

that filters out all but Corona generated messages.  Perhaps you could put the Corona:v *.s in your tool somehow and see if that helps.  If not, please install the adb tools, and run that command from the “cmd” command line terminal.  Without it, helping you further is going to just be a guessing game.  Even if you can’t make sense of it, there are people who can.  Post the output here.

Okay, I have the android sdk installed on my pc. When I type what you sat above it sits there with Waiting for device. Do I need to install anything else? I have a samsung galaxy s2 phone. Do I need to install anything for the phone? I tried searching and cannot find more information. Everything I find assumes you know all of this already.

When I type adb devices for a list of devices attached it just returns List of devices attached with nothing below it. So it must not see my phone.

Thanks,

Warren

Today I was playing with the app LogCat on my phone and ran the game with it and then looked at the log. I did the filter for corona and saw the error. It says I am getting a runtime error - module ‘sceneHome’ not dound: resource (sceneHome.lu) does not exist in archive.

Why did it say sceneHome.lu instead of .lua at the end? When I am calling the gotoScene I am just calling the sceneHome and not the extension. Also when I look at the screen shot further down it does refer to sceneHome.lue. Why can it not find the file? It starts out on this file when I go to the game.

Here is the function when I click to go to sceneHome:

local function nextScene( event ) if event.phase == "ended" then storyboard.gotoScene( "sceneHome" ) storyboard.purgeScene( "sceneGame" ) end end

Here is the log for the error:

er1.jpg

Thanks!!!

The logging simply leaves of the “a” in .lua.  You don’t need to worry about it. When you see .lu, it means .lua.

All of your scene files are .lua files that you pass (without the .lua) to the storyboard functions.   In other words:

storyboard.gotoScene(“sceneHome”)

is trying to read in sceneHome.lua and I would be willing to be that you have the file named something like  “scenehome.lua” (all lower case) or maybe “SceneHome.lua” with that capital S or some other situation where you have a case sensitivity problem.  The scene name in storyboard.gotoScene() has to match exactly with the filename stored in your project (without the .lua, and the .lua has to be all lower case)

I appreciate the help but I checked the files in the folder and the code and it is correct. It must be something else because on the device I can go to sceneHome from the menu on every page except for the game scene. I posted the code that is in the event nextScene above. I changed it to another scene in my app such as sceneEvents and the same thing happens. I can go to the sceneEvents from any other page but not from the sceneGame page.

I’ll try again posting an update under the jobs forum to see if someone can fix this for a payment because I cannot figure it out.

Attached is the full project minus one of the Facebook scenes because of my info in it. It has a few things changed because I thought the sound and other controls were causing the problem so I either removed or commented out some stuff.

I have been stuck on this for a couple weeks now. If anyone can help please let me know.

Thanks!

Warren

The attachment didn’t come through.  That error message means either sceneHome doesn’t exist or it has errors.

Can you capture a directory listing of your project folder for me?

Thanks for looking into this. I made a screen shot of the directory listings. I also re-uploaded the file for the project with the link below.

Here is the directory:

luafiles.jpg

And here is a link to the zip file for the project:

http://www.tybeesoftware.com/saloon88.zip

DARN!!! In the window I see Scene capitalized… I SWEAR it wasn’t before. Let me try to fix this now…

Often when something works in the simulator but not on your device, it’s because file names are case-sensitive on the device but not on the simulator.

Have you inspected the log output from your device to see if it reports any errors?  See tip #5 on this blog post for some info how to see it: http://www.coronalabs.com/blog/2012/09/26/faq-wednesday-ios-builds-api-docs-and-android/

  • Andrew

Thanks. I double checked and everything is good there. I made sure the names of the scene it calls matches the case of the actual file. Still locks up…

Well, it wouldn’t necessarily be just the name of the scene matching, but any file that the scene accesses (e.g., images that it loads).

Also, when you said “everything is good there”, did you mean you checked adb logcat, and you saw no error messages?

  • Andrew