In my app i have background image and as decorative i have objects falling from the top of the screen down.
The code for this is in the main.lua file at the end of that i use composer to go to the first scene.
In that scene the falling objects are behind the button. But to scenes further the are not.
In between i have to stop the spawning and delete all the falling objects on the screen.
Main.lua:
bg = display.newImage( visuals.bgImage, w/2, h/2, true) --code for background objects local gameValues = require("gameValues") local mathRandom = math.random bgObjects = display.newGroup() local bgTimer function startbgObjects() bgTimer = timer.performWithDelay( gameValues.spawnTime, spawnbgObject, 0 ) end function stopbgObjects() timer.cancel( bgTimer ) display.remove( bgObjects ) bgObjects = display.newGroup() end --goto startscreen local composer = require("composer") composer.gotoScene( "StartScene", { effect="fade", time= 500 } )
The startObjects function is called in the scene.will show and
the stopObjects is called in the scene will hide.
I have tried to put the objects behind the button in the third scene by using:
bgObjects:toBack()
but this caused it to go behind the background image.
How can i make it that the objects go between the background and the button of the screen?
Thanks in regards.