This following code detects the collisions and removes the “soldier” but it does not get rid of the physics body around the soldier, do you think it is here where the issue is, or is there a problem with the spawn function which i will post when if you need to see it!
local function onLocalCollision(self, event) if event.other.name == "bullet" then display.remove(event.other) soldierHealth = soldierHealth - 5 if soldierHealth == 0 then --display.remove(soldier) --soldier = nil soldier:removeSelf() soldier = nil removeBody() print("DEAD") end end end soldier.collision = onLocalCollision soldier:addEventListener("collision", soldier)