Here is the code of the function that destroys objects. The caller passes the object to remove as self and each object gets it's own remove function so that
Code: Select all
if thing thing then
objects[k].remove(k)
end
here is function (also in for loop going through all objects):
Code: Select all
v.remove = function(self)
objects[self].body:destroy()
objects[self] = nil
table.remove(objects, tonumber(k))
end
here is .love file:
EDIT:
to cause the mouse joint error, hold onto the scientist and crash him into a wall really hard then wait a few seconds for him to fade out
to cause the weld joint crash, hit escape and enable weld mode, then resume and fling scientist into a wall really hard and wait a few seconds for him to fade out.