Hey guys so how do I make certain objects collide with each other. I have used collision filters but not sure how to make it so it is more then one object.
local physics = require("physics") physics.start() local snown = 400 local bottomX = display.contentWidth/4 local bottomY = display.contentHeight+10 local can = true local bottomX1 = display.contentWidth-50 local bottomY1 = display.contentHeight-50 local xw = display.contentWidth+200 local yw = display.contentHeight-400 local bg = display.newRect(0,0,xw+150,display.contentHeight+500) bg:setFillColor(0,0,0) local lwall = display.newRect(display.contentWidth,display.contentHeight-200,10,display.contentHeight) lwall:setFillColor(0,0,0) physics.addBody(lwall,"static") local rwall = display.newRect(0,display.contentHeight-200,10,display.contentHeight) rwall:setFillColor(0,0,0) physics.addBody(rwall,"static") local flagCollisionFilter = { categoryBits=2,maskBits=3} local flagFinal = display.newImage("flagfinal.png",bottomX1,bottomY1) physics.addBody(flagFinal,"static",{filter=flagCollisionFilter}) local snowdis = display.newText(snown,270,10,"candy.ttf",50) snowdis:setFillColor(1,0,0) local ground = display.newRect(bottomX,bottomY,xw,yw) physics.addBody(ground,"static",{friction = 5,bounce = 0}) local platform = display.newRect(10,10,display.contentWidth,10) physics.addBody(platform,"static",{bounce = 0}) platform:setFillColor(0,0,0) local sledCollistionFilter = {categoryBits=2,maskBits=3} local sled = display.newRect(platform.x+20,platform.y-20,50,10) physics.addBody(sled,"dynamic",{density=0, friction=5, bounce=0.1,filter=sledCollistionFilter}) local snowCollistionFilter = {categoryBits =4,maskBits=5} local function spawnflakes(event) if can == true then if snown \>= 1 then snowflake = display.newCircle(event.x,event.y,math.random(5,10)) physics.addBody(snowflake,"dynamic",{filter = snowCollistionFilter}) print("Let It Snow!") snown = snown - 1 snowdis.text = snown print(snown) end end end bg:addEventListener("touch",spawnflakes) local playbtn = display.newImage("playbtn.png",bottomX1,bottomY) playbtn:rotate(90) local function play( event ) platform:removeSelf() can = false end playbtn:addEventListener("tap",play) local restarticon = display.newImage("restarticon.png",playbtn.x/4,playbtn.y)