So, i’m not sure why when ANY object collides with either one of these two objects, it changes scene, i only want it to change scene when these two collide, not when any other object collides with it, how can i do this? thanks!
[code]
local crate1 = display.newImage( “scroll.png”, 180, 170 )
physics.addBody( crate1, { density = 3.0, friction = 0.3, bounce = 0.1 } )
crate1.myName = “first crate”
localGroup:insert(crate1)
local crate2 = display.newImage( “ground.png”, 0, 400 )
physics.addBody( crate2, “static”, { friction=1.5, bounce=0.1 } )
crate2.myName = “second crate”
localGroup:insert(crate2)
local function onCollision( event )
if ( event.phase == “began” ) then
print( "began: " … event.object1.myName … " & " … event.object2.myName )
elseif ( event.phase == “ended” ) then
timer.performWithDelay(10, changeScene, 1)
end
end
Runtime:addEventListener( “collision”, onCollision )
[/code] [import]uid: 10827 topic_id: 10036 reply_id: 310036[/import]