Collision Issue...

I have a function that spawns items, it works.  However, after a few spawns, the collion “body” turns into a faded green, instead of a bright green.  Here is my code…

local function spawnObject() local chance = math.random(100) if chance \< 50 then generateItem() local randomLane = math.random(100) local object = createObject(item) objectGroup:insert(object) object.Name = "object".. i i = i+1 object.x = 1400 object.isHitTestable = true object:toBack() physics.addBody( object , { friction=0.5, bounce=0.3, radius=35} ) object:setCollision() object:setOnAnimationComplete() if randomLane \< 33 then object.y = lane1 object.x = transition.to( object, { time=travelTime, x= -850, y = object.y ,onComplete=removeObject} ) else if randomLane \< 66 then object.y = lane2 object.x = transition.to( object, { time=travelTime, x= -850, y = object.y ,onComplete=removeObject} ) else if randomLane \<=100 then object.y = lane3 object.x = transition.to( object, { time=travelTime, x= -850, y = object.y ,onComplete=removeObject} ) end end end else if chance \< 100 then generateItem() local randomLane = math.random(100) local object = createObject(item) objectGroup:insert(object) object.Name = "object".. i i = i+1 object.x = 1400 object.isHitTestable = true object:toBack() physics.addBody( object , { friction=0.5, bounce=0.3, radius=35} ) object:setCollision() object:setOnAnimationComplete() if randomLane \< 33 then object.y = lane1 object.x = transition.to( object, { time=travelTime, x= -850, y = object.y ,onComplete=removeObject} ) else if randomLane \< 66 then object.y = lane2 object.x = transition.to( object, { time=travelTime, x= -850, y = object.y ,onComplete=removeObject} ) else if randomLane \<=100 then object.y = lane3 object.x = transition.to( object, { time=travelTime, x= -850, y = object.y ,onComplete=removeObject} ) end end end generateItem() local randomLane2 = math.random(100) local object2 = createObject(item) objectGroup:insert(object2) object2.Name = "object".. i i = i+1 object2.x = 1400 object2.isHitTestable = true object2:toBack() physics.addBody( object2 , { friction=0.5, bounce=0.3, radius=35} ) object2:setCollision() object2:setOnAnimationComplete() if randomLane2 \< 33 then object2.y = lane2 object2.x = transition.to( object2, { time=travelTime, x= -850, y = object2.y ,onComplete=removeObject} ) else if randomLane \< 66 then object2.y = lane3 object2.x = transition.to( object2, { time=travelTime, x= -850, y = object2.y ,onComplete=removeObject} ) else if randomLane \<=100 then object2.y = lane1 object2.x = transition.to( object2, { time=travelTime, x= -850, y = object2.y ,onComplete=removeObject} ) end end end end end end

I don’t see where you posted your generateItem() function. Please post this so we can take a look.

I don’t see where you posted your generateItem() function. Please post this so we can take a look.