I followed what you said, And i narrowed to problem to the “physics.stop/start” functions…
When I exit the physical scene for the 1st time, everything works properly. When I exit it for the 2nd time, I receive many “physics.start has not been called” logs and the objects continue to the other scene…
this is my code-
module(…,package.seeall);
local storyboard = require( “storyboard” )
local main = require “main”
local physics = require “physics”
local crate = require “crate”
local ball = require “ball”
local game = require “game”
local score = require “score”
local scene1= require “scene1”
local scene = storyboard.newScene()
function scene:createScene( event )
function scene_time_bg()
game.gameStart()
btn_ball = display.newImage(“Photos/Ball.png”)
btn_ball.x=900
btn_ball.y=560
btn_ball.xScale=1.1
btn_ball.yScale=1.1
btn_ball:toFront()
score.setCombo()
end
function scene_time_start()
local timeref=90
ball.startBall(btn_ball)
score.countDown()
local timeLastEnemy = 0
local timeLastBomb = 0
local function dropBomb()
function dropbombAction()
crate.newBomb()
end
timer.performWithDelay(math.random(600, 800), dropbombAction);
end
local function dropBox()
function dropcrateAction()
crate.newCrate()
end
timer.performWithDelay(math.random(500, 900), dropcrateAction);
end
local function gameLoop(event)
if event.time - timeLastEnemy >= math.random(400, 800) then
dropBox()
timeLastEnemy = event.time
if event.time - timeLastBomb >= math.random(1500,2000) then
dropBomb()
timeLastBomb = event.time
end
end
end
local time = 60
ScoreRef=score.showScore()
Runtime:addEventListener(“enterFrame”, gameLoop)
function removeEvent()
Runtime:removeEventListener(“enterFrame”, gameLoop)
end
end
end
function scene:enterScene( event )
scene_time_bg()
physics.start()
timer.performWithDelay(1000,scene_time_start)
end
function scene:exitScene( event )
storyboard.removeScene(“scene_time”)
end
function scene:destroyScene( event )
physics.stop()
removeEvent()
crate.removeTables()
end
scene:addEventListener( “createScene”, scene )
scene:addEventListener( “enterScene”, scene )
scene:addEventListener( “exitScene”, scene )
scene:addEventListener( “destroyScene”, scene )
return scene
Clearly I’m doing something wrong…Can you tell me what that is?