Removing objects from the world?

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.
Post Reply
User avatar
Quentin
Prole
Posts: 8
Joined: Thu Jul 12, 2012 3:52 am

Removing objects from the world?

Post by Quentin »

I've made a little game where you can jump on randomly generated platforms, and I'm trying to make it so that when you press G, it generates new ones.
It seems to be working fine, the platforms get cleared and new ones generate, but the actual body of the platform is still there, it's like an invisible platform.

Is it possible to remove an object from the world? I can't find anything on it D:

Thanks!
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: Removing objects from the world?

Post by Boolsheet »

You mean World from the love.physics module, right?

In 0.8.0, you have to explicitly destroy the Bodies yourself with Body:destroy. This will also destroy all Fixtures and Joints attached to that Body.

And once you're finished using the World, call destroy on it too to clean it up.
Shallow indentations.
User avatar
Quentin
Prole
Posts: 8
Joined: Thu Jul 12, 2012 3:52 am

Re: Removing objects from the world?

Post by Quentin »

Boolsheet wrote:You mean World from the love.physics module, right?

In 0.8.0, you have to explicitly destroy the Bodies yourself with Body:destroy. This will also destroy all Fixtures and Joints attached to that Body.

And once you're finished using the World, call destroy on it too to clean it up.
Thanks a lot!
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 5 guests