I wrote a very short test code: when I touch the picture of the car, the ball drawn above it disappears.
function carTouch( event ) local t = event.target local phase = event.phase if ( phase == "began" ) then local parent = t.parent parent:insert( t ) display.getCurrentStage():setFocus( t ) instance = parent t.isFocus = true elseif ( t.isFocus ) then if ( phase == "moved" ) then elseif ( ( phase == "ended" ) or ( phase == "cancelled" ) ) then print(" t o u c h ! ! ") display.getCurrentStage():setFocus( nil ) t.isFocus = false end end return true end car = display.newImage( "car.png" , 384 , 224 ) car:addEventListener( "touch" , carTouch ) ball = display.newImage( "ball.png" , 108 , 108 ) ball.x = car.x ball.y = car.y
thanks :o