Hi again I’m encountering this strange problem what happen is I have these two platforms moving horizontally the screen in portrait right. What happens after I think about 3 minutes the platforms would lag a lot and then corona simulator would stop responding what could this be here the code that I did it with.
[code] local physics = require “physics”
physics.start()
local recycle
local transit
local stage = display.newRect(100, 100, 100 ,100)
stage.x = 160
stage.y = 400
physics.addBody(stage ,“static”,{ density = 1.5, friction = 12.0, bounce = 0.0 })
local ball = display.newCircle(10,10,10,10)
ball.x = 160
ball.y = 240
physics.addBody(ball, { density = 1.5, friction = 0.0, bounce = 0.1 })
local paddle = display.newRect(0,500,100,20)
paddle.y = 480
paddle.x0 = 500
physics.addBody(paddle, “static” )
local paddle2 = display.newRect(0,500,100,20)
paddle2.y = 500
paddle2.x0 = 480
physics.addBody(paddle2, “static” )
function transit()
transition.to(paddle, {time=2000 , x = 400 - 600, onComplete= recycle})
transition.to(paddle2, {time=2000, x = 480 - 600, onComplete= recycle})
end
function recycle()
paddle.x = paddle.x0
paddle.y = 50 + math.random( 320 )
paddle2.x = paddle2.x0
paddle2.y = 50 + math.random( 320 )
transit()
end
local onTouch = function(event)
if ball.canJump then
ball:applyLinearImpulse(0, -5, ball.x, ball.y)
end
end
Runtime:addEventListener(“tap”, onTouch)
local function onCollision(self, event )
if ( event.phase == “began” ) then
if event.other.stage then
ball.canJump = true
end
elseif ( event.phase == “ended” ) then
if event.other.stage then
ball.canJump = false
end
end
end
ball.collision = onCollision
ball:addEventListener( “collision”, ball )
transit()[/code]
[import]uid: 17058 topic_id: 19676 reply_id: 319676[/import]