Bump error "item object must be added..."

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.
User avatar
darkfrei
Party member
Posts: 1169
Joined: Sat Feb 08, 2020 11:09 pm

Re: Bump error "item object must be added..."

Post by darkfrei »

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
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
Post Reply

Who is online

Users browsing this forum: No registered users and 57 guests