Physics: Way to check if "not" colliding?

Is there a way to check if a physics object is not colliding with anything? I’m using sensors for what I thought would be simple collision checks for a checkers type game.

Every square on the board checks to see if there’s a piece on it. It returns “nil” if there’s not a piece. If there is a piece, it returns “red” or “black.” When I move a piece, how do I get that now-empty square to return “nil”? [import]uid: 191140 topic_id: 35608 reply_id: 335608[/import]

[lua]square.collideTile = nil
function square:collision(e)
if (e.phase == “began”) then
square.collideTile = e.other – record colliding tile when the collision begins
else
square.collideTile = nil – when the collision ends indicate that no tile is there any more
end
return true
end
square:addEventListener(“collision”,square)[/lua] [import]uid: 8271 topic_id: 35608 reply_id: 141538[/import]

Awesome! Thank you. I had no idea I could just use an else statement for the “began” phase. Simple answers are my favorite kind of answers. :slight_smile: [import]uid: 191140 topic_id: 35608 reply_id: 141559[/import]

http://lua-users.org/wiki/ControlStructureTutorial
http://developer.coronalabs.com/content/collision-detection [import]uid: 8271 topic_id: 35608 reply_id: 141650[/import]

[lua]square.collideTile = nil
function square:collision(e)
if (e.phase == “began”) then
square.collideTile = e.other – record colliding tile when the collision begins
else
square.collideTile = nil – when the collision ends indicate that no tile is there any more
end
return true
end
square:addEventListener(“collision”,square)[/lua] [import]uid: 8271 topic_id: 35608 reply_id: 141538[/import]

Awesome! Thank you. I had no idea I could just use an else statement for the “began” phase. Simple answers are my favorite kind of answers. :slight_smile: [import]uid: 191140 topic_id: 35608 reply_id: 141559[/import]

http://lua-users.org/wiki/ControlStructureTutorial
http://developer.coronalabs.com/content/collision-detection [import]uid: 8271 topic_id: 35608 reply_id: 141650[/import]