By default, all bodies collide with all other bodies, but i want to fine-tune this behavior. For example, i have 4 obects one of them are let’s say hero(Dynamic body), 2 enemy(static body) and one reward(dynamic) object
if enemy collides with reward the game ends
and even if enemy collide with hero the game ends
but i don’t want end the game when when hero collide with reward i want display as
local text “” you won " something like this
my current code is
function onCollision (event)
object:removeSelf()
local text = display.newText(“Game Over. Try Again”, display.contentCenterX, display.contentCenterY, native.systemFontBold, 50)
Runtime:addEventListener(“collision”, onCollision)
Can anone help me .