Hi Brent,
I manage to make the collision working only with one of the 2 objects (the cowboy),but the cowboy is a global variable. I have a cow that is a local variable,and when the beam colide with it,it gives me an error.Also please check the warning on the console.
local function cow (event) local sheetData = {width = 100,height = 100,numFrames = 14,sheetContentWidth = 200,sheetContentHeight = 700} local mySheet = graphics.newImageSheet ("cow.png",sheetData) local sequenceData = {{name = "cowOne2",start = 1,count = 8,time = 1000,loopcount = 0}, {name = "cowBeaming",frames = {9,10,11,12,13,14},time = 1000,loopcount = 0}} local cowOne = display.newSprite (mySheet,sequenceData) cowOne.x = 35 cowOne.y = 450 cowOne.rotation = 90 cowOne:play() physics.addBody (cowOne,"static",{friction = 0.2,radius = 22}) cowOne.gravityScale = 0 cowOne.isSensor = true cowOne:setLinearVelocity (0,0) --line 171 return cowOne end local function cowSpawnOne (event) for i = 0,0 do local cowOne1 = cow() cowOne1.x = 38 cowOne1.y = math.random (600,850) local removeCow = function () display.remove (cowOne) cowOne1 = nil end cowIntro = transition.to (cowOne1,{time = 23000,y = -50,onComplete = removeCow}) if score == 300 then cowIntro = transition.to (cowOne1,{time = 18000,y = -50,onComplete = removeCow}) if score \>= 300 then cowIntro = transition.to (cowOne1,{time = 15000,y = -50,onComplete = removeCow}) end end end end local function cowAnimOne (event) local c1 = cow() -- line 195 c1:setSequence ("cowBeaming") c1:play() end local function cowAnimTwo (event) local c2 = cow() c2:setSequence ("cowOne2") c2:play() end local function beaming (event) if event.phase == "began" then cowAnimOne() -- line 208 end end