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 .
o08oo
Prole
Posts: 2 Joined: Sun Apr 05, 2020 4:57 pm
Post
by o08oo » Sun Apr 05, 2020 5:33 pm
I'm trying to clear the scene in order to load another one, but no matter what I try I can't clear the collision objects.
I tried
Code: Select all
for i = 1,#self.walls do
self.HC:remove(self.walls[i])
end
and the error is
HC/init.lua:75: attempt to call method 'bbox' (a nil value)
I also tried
Code: Select all
for i = 1,#self.walls do
local hash = scene.HC:hash()
hash:remove(self.walls[i], self.walls[i]:bbox())
end
which gives the error
HC/init.lua:49: attempt to index local 'self' (a nil value)
More info in code tags because I don't know how to do inline code:
Code: Select all
"self.walls[i]" definitely exists because "self.player:moveTo(self.walls[i]._polygon.centroid.x,self.walls[i]._polygon.centroid.y)" works (inside the loop) so that's probably not the problem, and "self.walls[i]:bbox()" works too.
Move to the yellow square and press e.
Attachments
gametest - Copy (6).love
(78.15 KiB) Downloaded 137 times
Last edited by
o08oo on Sun Apr 05, 2020 8:49 pm, edited 1 time in total.
pgimeno
Party member
Posts: 3682 Joined: Sun Oct 18, 2015 2:58 pm
Post
by pgimeno » Sun Apr 05, 2020 7:38 pm
Welcome to the forums!
Have you tried HC.remove instead of HC:remove?
o08oo
Prole
Posts: 2 Joined: Sun Apr 05, 2020 4:57 pm
Post
by o08oo » Sun Apr 05, 2020 8:46 pm
pgimeno wrote: ↑ Sun Apr 05, 2020 7:38 pm
Welcome to the forums!
Have you tried HC.remove instead of HC:remove?
Thank you, it worked!
Users browsing this forum: Ahrefs [Bot] , Amazon [Bot] , Bing [Bot] , Google [Bot] and 5 guests