Hello everyone,
I need help on this non physics collision event. I’ve made a table of 3 objects(line1, line2 and line3) and object that I have named collOb. The problem is collision event works only with line1. I’ve worked with non physics collision event before but only between 2 objects not more like now. Thanks!
objects = {} for i=1, 1 do objects[i] = line , line2 ,line3 ; end local function hasKollided(obj1, obj2) if obj1 == nil then return false end if obj2 == nil then return false end local left = obj1.contentBounds.xMin \<= obj2.contentBounds.xMin and obj1.contentBounds.xMax \>= obj2.contentBounds.xMin local right = obj1.contentBounds.xMin \>= obj2.contentBounds.xMin and obj1.contentBounds.xMin \<= obj2.contentBounds.xMax local up = obj1.contentBounds.yMin \<= obj2.contentBounds.yMin and obj1.contentBounds.yMax \>= obj2.contentBounds.yMin local down = obj1.contentBounds.yMin \>= obj2.contentBounds.yMin and obj1.contentBounds.yMin \<= obj2.contentBounds.yMax return (left or right) and (up or down) end local isCheckingCollisions = false local function testKollisions() if isCheckingCollisions then return true end isCheckingCollisions = true for i=1, #objects do if hasKollided(objects[i], collOb) then number = math.random( 5 ) print(number) --- collision code here end isCheckingCollisions = false return true end