Making a simple game in Love 2D framework where if I click on an object then it disappears.
Do I check to see if I've clicked the enemy inside a function in the enemy object? Or just in my main.lua? Currently I have this code in my main.lua:
function love.mousepressed(x, y, button)
if button == "l" then
for i,b in ipairs(bugs) do
if b:isClicked(x, y) then
table.remove(bugs, i)
end
end
end
end
Is there a standard design pattern on where this code should belong?