Hello again, now how do i make an event listener work? i have the drag body function here…
function dragBody( self, event, params ) local body = event.target local phase = event.phase local stage = display.getCurrentStage() if "began" == phase then stage:setFocus( body, event.id ) body.isFocus = true if params and params.center then body.tempJoint = physics.newJoint( "touch", body, body.x, body.y ) else body.tempJoint = physics.newJoint( "touch", body, event.x, event.y ) end if params then local maxForce, frequency, dampingRatio if params.maxForce then body.tempJoint.maxForce = params.maxForce end if params.frequency then body.tempJoint.frequency = params.frequency end if params.dampingRatio then body.tempJoint.dampingRatio = params.dampingRatio end end elseif body.isFocus then if "moved" == phase then body.tempJoint:setTarget( event.x, event.y ) elseif "ended" == phase or "cancelled" == phase then stage:setFocus( body, nil ) body.isFocus = false body.tempJoint:removeSelf() end end return true end
i added the table to the drag body as you can see above… now in my spawnCircle function when i try adding the event listener it gives an error… here the listener
ball[i]:addEventListener( "touch", dragBody )
And yes im listening to you on that i should remove the table and all but i have to fix this first and then ill make a video on what im trying to do and accomplish so you understand better and could maybe help me out further