Issue Caused by Downloading New SDK Version: composer.gotoScene problem

I downloaded 29.78 today and I am running into an issue.

I have a scene called “LEVEL TRACKER”.  And in this scene, when they push the button for one of the levels the game takes them to that scene.  Now it is giving me an error message in the “gotoScen” in function ‘_onEvent’

Existing Code:  The line in red is the line the error message occurs on.  SEE second comment

Sorry about the code, It was formatted when I loaded it up but when I hit post it got jumbled.  The row in red is the row throwing the problem. 


–LEVEL TRACKER  


local composer = require( “composer” )

local scene = composer.newScene()

–BUNCH OF CODE

– Button handler to cancel the level selection and return to the menu

local function handleCancelButtonEvent( event )

      if ( “ended” == event.phase ) then

        composer.gotoScene( “menu”, { effect=“crossFade”, time=333 } )

        end

              return true

        end

– Button handler to go to the selected level

local function handleLevelSelect( event )

      if ( “ended” == event.phase ) then

                 – ‘event.target’ is the button and ‘.id’ is a number indicating which level to go to.  

                 – The ‘game’ scene will use this setting to determine which level to load.

                 – This could be done via passed parameters as well.

       

      --mydata.settings.currentLevel = event.target.id

              local prevgameLives = gameLife.loadgameLives(“gameLivesfile.txt”)

             prevgameLives = tonumber(prevgameLives)

                if prevgameLives > 0 then

                        local levNumber = tonumber(event.target.id)

                        currentLevel = levNumber

                          myData.settings.currentLevel = levNumber

                         utility.saveTable(myData.settings,“settings.json”)

  

         local scene = (“level”…levNumber)

                composer.removeScene( scene, false )

                 composer.gotoScene( scene, { effect = “crossFade”, time=333 } )

  end

         end

                      end

Thanks

I figured it out.  I had inadvertently omitted some code.

Sorry about the code, It was formatted when I loaded it up but when I hit post it got jumbled.  The row in red is the row throwing the problem. 


–LEVEL TRACKER  


local composer = require( “composer” )

local scene = composer.newScene()

–BUNCH OF CODE

– Button handler to cancel the level selection and return to the menu

local function handleCancelButtonEvent( event )

      if ( “ended” == event.phase ) then

        composer.gotoScene( “menu”, { effect=“crossFade”, time=333 } )

        end

              return true

        end

– Button handler to go to the selected level

local function handleLevelSelect( event )

      if ( “ended” == event.phase ) then

                 – ‘event.target’ is the button and ‘.id’ is a number indicating which level to go to.  

                 – The ‘game’ scene will use this setting to determine which level to load.

                 – This could be done via passed parameters as well.

       

      --mydata.settings.currentLevel = event.target.id

              local prevgameLives = gameLife.loadgameLives(“gameLivesfile.txt”)

             prevgameLives = tonumber(prevgameLives)

                if prevgameLives > 0 then

                        local levNumber = tonumber(event.target.id)

                        currentLevel = levNumber

                          myData.settings.currentLevel = levNumber

                         utility.saveTable(myData.settings,“settings.json”)

  

         local scene = (“level”…levNumber)

                composer.removeScene( scene, false )

                 composer.gotoScene( scene, { effect = “crossFade”, time=333 } )

  end

         end

                      end

Thanks

I figured it out.  I had inadvertently omitted some code.