interupting a scene

Hey Everyone. I’m trying to add a “cut scene” into my app, by changing scenes after a level is selected, if there’s a comic to be shown. To accomplish this, I added a new entry into my level json info “hasComic”, which is then read, applied to the level markers. That’s all well and working, the problem is when I actually go to the scene. loads (my test line in scene create prints), but it doesn’t seem to stay there, as I would expect it to, and it continues on to the next scene in the program, which goes to the actual game board.

At this point, the new scene is very basic, just the test print and a display image in create:scene() and everything else is stock from the tutorial. Anywhere, here’s the relevant code:

 if (hasComic == true) then composer.gotoScene("src.showComic","fade", 400) print( "has a comic" ) end

-- "scene:create()" function scene:create( event ) --print(event.params.index) local sceneGroup = self.view -- Initialize the scene here. -- Example: add display objects to "sceneGroup", add touch listeners, etc. print( "in the show comic scene" ) local comic = display.newImageRect( sceneGroup,"img//comics/l001comic.png", 320,390) comic.y = display.contentCentery comic.x = display.contentCenterX end

The above is no longer an issue. I moved the location where I make the call to the new scene, and it’s all working now, on that end. However, I’m attempting to pass the options needed to load the actual level (for after the comic), but it event.params keeps returning “nil”, here’s what I’ve got

 local options = { effect = "fade", time = 500, params = { levelConfig=level, themeConfig=themeConfig, gameMode=gameMode } } self.view = nil if (gameSettings.currentLives \>0) then print( "You've got lives left!" ) if (showComic == true) then print( "showing the Comic" ) composer.gotoScene("src.showComic","fade", 400,options) composer.removeScene("levelSelect") else composer.gotoScene( "src.GameScene", options ) composer.removeScene("levelSelect") end return true else outOfLives() end end

and then in the cutscene file

function scene:create( event ) --print(event.params.index) local sceneGroup = self.view -- Initialize the scene here. -- Example: add display objects to "sceneGroup", add touch listeners, etc. print( "in the show comic scene" ) options = event.params local comic = display.newImageRect( sceneGroup,"img//comics/l001comic.png", 320,390) comic.y = display.contentHeight/2 comic.x = display.contentWidth/2 local continue = display.newImageRect( sceneGroup,"img/play.png",91,55 ) continue.x = display.contentWidth/2 continue.y = 600 continue:addEventListener( "tap",ReturnTolast ) end

as always, thanks in advance for any help!

Hate to bump this but i’m still struggling with this. I’ve tried it both as an overlay, and an entirely new scene, and both aare getting me to the same point: a nil value for the table that’s passed to the next scene (which works perfectly fine for the levels that don’t have a comic)

The above is no longer an issue. I moved the location where I make the call to the new scene, and it’s all working now, on that end. However, I’m attempting to pass the options needed to load the actual level (for after the comic), but it event.params keeps returning “nil”, here’s what I’ve got

 local options = { effect = "fade", time = 500, params = { levelConfig=level, themeConfig=themeConfig, gameMode=gameMode } } self.view = nil if (gameSettings.currentLives \>0) then print( "You've got lives left!" ) if (showComic == true) then print( "showing the Comic" ) composer.gotoScene("src.showComic","fade", 400,options) composer.removeScene("levelSelect") else composer.gotoScene( "src.GameScene", options ) composer.removeScene("levelSelect") end return true else outOfLives() end end

and then in the cutscene file

function scene:create( event ) --print(event.params.index) local sceneGroup = self.view -- Initialize the scene here. -- Example: add display objects to "sceneGroup", add touch listeners, etc. print( "in the show comic scene" ) options = event.params local comic = display.newImageRect( sceneGroup,"img//comics/l001comic.png", 320,390) comic.y = display.contentHeight/2 comic.x = display.contentWidth/2 local continue = display.newImageRect( sceneGroup,"img/play.png",91,55 ) continue.x = display.contentWidth/2 continue.y = 600 continue:addEventListener( "tap",ReturnTolast ) end

as always, thanks in advance for any help!

Hate to bump this but i’m still struggling with this. I’ve tried it both as an overlay, and an entirely new scene, and both aare getting me to the same point: a nil value for the table that’s passed to the next scene (which works perfectly fine for the levels that don’t have a comic)