Re: Bump error "item object must be added..."
Posted: Thu Dec 01, 2022 1:22 pm
The error comes that you move the dead bullet, but the dead bullet must be removed from bullets list. Why the dead bullet is in this list?
Update:
The code must be like:
Code: Select all
function updateBullets (dt)
for index = #Bulltes, 1, -1 do
local bullet = Bullets[i]
bullet:update (dt)
if bullet.dead then
table.remove (Bullets, index)
world:remove (bullet)
end
end
end