How to handle object touch when multitouch?

Hi everyone,

I have 2 balls and I’m using the code from the pool example to shoot them:

I removed the rotating circle around ball to simplify the code

 local function cueShot( event )  
  
 local t = event.target  
  
 local phase = event.phase  
 if "began" == phase then  
 display.getCurrentStage():setFocus( t )  
 t.isFocus = true  
 myLine = nil  
  
 elseif t.isFocus then  
 if "moved" == phase then  
  
 if ( myLine ) then  
 myLine.parent:remove( myLine ) -- erase previous line, if any  
 end  
 myLine = display.newLine( t.x,t.y, event.x,event.y )  
 myLine:setColor( 255, 255, 255, 50 )  
 myLine.width = 8  
  
 elseif "ended" == phase or "cancelled" == phase then  
 display.getCurrentStage():setFocus( nil )  
 t.isFocus = false  
  
 if ( myLine ) then  
 myLine.parent:remove( myLine )  
 end  
  
 -- Strike the ball!  
 local missile = getMissile();  
 t:applyForce( (t.x - event.x), (t.y - event.y), t.x, t.y )  
 end  
 end  
  
 -- Stop further propagation of touch event  
 return true  
 end  

How can I modify this to be able to shoot the 2 balls at the same time? with current code when you are handling one ball with a touch if I try to handle the second ball I can’t. Both touches have the first ball as target and I see 2 lines drawn from the first ball to the 2 fingers.

I checked the api and I see there’s an event.id that is suppoused to be useful in multitouch situations but I can’t find an example.

thanks [import]uid: 49941 topic_id: 13272 reply_id: 313272[/import]