Sorry to be late to answer, i was in class today.
I’m not really sure to understand what you said,
look at this :
bg_menulvl.lua :
local storyboard = require( "storyboard" ) local scene = storyboard.newScene() local widget = require "widget" local game = include "game" local function onbtn\_back() storyboard.gotoScene( "bg\_home", "fade", 500 ) return true end local function onbtn\_startlevel1() end local function onbtn\_startlevel2() end local function onbtn\_startlevel3() end local function onbtn\_startlevel4() end local function onbtn\_startlevel5() end local function onbtn\_startlevel6() end local function onbtn\_startlevelarcade() storyboard.gotoScene( "bg\_arcade", "fade", 500 ) end local function onbtn\_startlevelchallenge() storyboard.gotoScene( "bg\_challenge", "fade", 500 ) end function scene:createScene( event ) local group = self.view local background = display.newImageRect( "images/backgrounds/bg\_menulvl.jpg", display.contentWidth, display.contentHeight ) background.x, background.y = display.contentCenterX, display.contentCenterY btn\_back = widget.newButton { defaultFile = "images/boutons/b\_back.png", width = 200, height = 200, left = 150, top = 80, onRelease = onbtn\_back } btn\_newyork = widget.newButton { defaultFile = "images/boutons/b\_newyork.png", width = 200, height = 200, left = 350, top = 250, --onRelease = onbtn\_startlevel1 } btn\_paris = widget.newButton { defaultFile = "images/boutons/b\_paris.png", width = 200, height = 200, left = 800, top = 180, --onRelease = onbtn\_startlevel2 } btn\_lecaire = widget.newButton { defaultFile = "images/boutons/b\_lecaire.png", width = 200, height = 200, left = 890, top = 400, --onRelease = onbtn\_startlevel3 } btn\_tokyo = widget.newButton { defaultFile = "images/boutons/b\_tokyo.png", width = 200, height = 200, left = 1550, top = 300, --onRelease = onbtn\_startlevel4 } btn\_moscou = widget.newButton { defaultFile = "images/boutons/b\_moscou.png", width = 200, height = 200, left = 1100, top = 170, --onRelease = onbtn\_startlevel5 } btn\_rio = widget.newButton { defaultFile = "images/boutons/b\_rio.png", width = 200, height = 200, left = 500, top = 650, --onRelease = onbtn\_startlevel6 } btn\_arcade = widget.newButton { defaultFile = "images/boutons/b\_arcade.png", width = 360, height = 128, left = 800, top = 600, onRelease = onbtn\_startlevelarcade } btn\_challenge = widget.newButton { defaultFile = "images/boutons/b\_challenge.png", width = 481, height = 128, left = 740, top = 750, onRelease = onbtn\_startlevelchallenge } group:insert( background ) group:insert( btn\_back ) group:insert( btn\_newyork ) group:insert( btn\_paris ) group:insert( btn\_lecaire ) group:insert( btn\_tokyo ) group:insert( btn\_moscou ) group:insert( btn\_rio ) group:insert( btn\_arcade ) group:insert( btn\_challenge ) end scene:addEventListener( "createScene", scene ) return scene
And
game.lua
local game = {} local widget = require "widget" local function onbtn\_pause() local Game Game = game.new("images/backgrounds/bg\_pause.jpg") Game:pauseGame() end local function onbtn\_home() storyboard.gotoScene( "bg\_home", "fade", 500 ) end local function onbtn\_map() storyboard.gotoScene( "bg\_menulvl", "fade", 500 ) end local function onbtn\_score() storyboard.gotoScene( "bg\_score", "fade", 500 ) end function game.new(levelN) local group = self.view function initGame() local background = display.newImageRect( levelN, display.contentWidth, display.contentHeight ) background.x, background.y = display.contentCenterX, display.contentCenterY btn\_pause = widget.newButton { defaultFile = "images/boutons/b\_pause.png", width = 150, height = 150, left = 1700, top = 40, onRelease = onbtn\_pause } -- Game logic to play end function initPause() local background = display.newImageRect( levelN, display.contentWidth, display.contentHeight ) background.x, background.y = display.contentCenterX, display.contentCenterY btn\_son = widget.newButton { defaultFile = "images/boutons/b\_son\_on.png", width = 200, height = 200, left = 150, top = 80, --onRelease = onbtn\_faq } btn\_fx = widget.newButton { defaultFile = "images/boutons/b\_fx\_on.png", width = 200, height = 200, left = 150, top = 300, --onRelease = onbtn\_faq } btn\_reprendre = widget.newButton { defaultFile = "images/boutons/b\_play.png", width = 200, height = 200, left = 1650, top = 80, onRelease = onbtn\_reprendre } btn\_recommencer = widget.newButton { defaultFile = "images/boutons/b\_replay.png", width = 200, height = 200, left = 1650, top = 300, onRelease = onbtn\_recommencer } btn\_home = widget.newButton { defaultFile = "images/boutons/b\_home.png", width = 200, height = 200, left = 150, top = 800, onRelease = onbtn\_home } btn\_map = widget.newButton { defaultFile = "images/boutons/b\_map.png", width = 200, height = 200, left = 400, top = 800, onRelease = onbtn\_map } btn\_score = widget.newButton { defaultFile = "images/boutons/b\_score.png", width = 200, height = 200, left = 1650, top = 820, onRelease = onbtn\_score } end function game:startGame() initGame() end function game:pauseGame() initPause() end group:insert( background ) return game end return game
When i’m on my file bg_menulvl.lua, I want to click on one of my 6 functions, with a special backgrounds for each of them, and after when i press the buttons pause, I want to go on the storyboard,
but when i try your technique, i fail, and don’t know why =/