Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help,
read this .
darkfrei
Party member
Posts: 1216 Joined: Sat Feb 08, 2020 11:09 pm
Post
by darkfrei » Thu Dec 01, 2022 1:22 pm
fridays18 wrote: ↑ Thu Dec 01, 2022 1:13 pm
darkfrei wrote: ↑ Thu Dec 01, 2022 12:57 pm
Why you call update bullet by dead bullet?
what do you mean?
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
Users browsing this forum: Bing [Bot] , Google [Bot] and 2 guests