Hi Brent,
after reading Rob’s comment your comment I did these changes :[lua]function scene:createScene(e)
local screenGroup = self.view
sc1_bg = display.newImageRect(“sc1_bg.png”, 512, 420)
sc1_bg.x = centerX; sc1_bg.y = centerY; sc1_bg.xScale = 1.108
screenGroup:insert(sc1_bg)
circle = display.newImageRect(“circle.png”, 64, 64)
circle.anchorY = 0; circle.anchorX = 0;
physics.addBody(circle, “dynamic”, {radius = 31})
circle2 = display.newImageRect(“circle.png”, 64, 64)
circle2.anchorY = 0; circle2.anchorX = 0; circle2.x = 420;
physics.addBody(circle2, “dynamic”, {radius = 31})
ceiling_lv1 = display.newRect(centerX, screenTop,568,5)
screenGroup:insert(ceiling_lv1)
ceiling_lv1.name = “wall”
physics.addBody(ceiling_lv1, “static”, {friction = 1})
left_lv1 = display.newRect(screenLeft, centerY, 5, 390)
left_lv1.name = “wall”
physics.addBody(left_lv1, “static”)
Bottom_lv1 = display.newRect(centerX, screenBottom, 568, 5)
Bottom_lv1.name = “wall”
physics.addBody(Bottom_lv1, “static”)
moveCircle()
moveCircle2()
end
function moveCircle()
tra1 = transition.to(circle,{time=900, x=math.random(80,510), y=math.random(10,285), onComplete=moveCircle})
end
function moveCircle2()
tra2 = transition.to(circle2,{time=900, x=math.random(80,510), y=math.random(10,285), onComplete=moveCircle2})
end
function circle1_collision(e)
if e.phase == “began” then
if (e.other.name == “wall”) then
transition.cancel(tra1)
timer.performWithDelay(2, moveCircle, 1)
end
end
end
function circle2_collision(e)
if e.phase == “began” then
if (e.other.name == “wall”) then
transition.cancel(tra2)
timer.performWithDelay(2, moveCircle2, 1)
end
end
end
function scene:enterScene(e)
circle:addEventListener(“collision”, circle1_collision)
circle2:addEventListener(“collision”, circle2_collision)
end[/lua]
now this seems to work but it feels like there’s something missed ?!