Can we reuse the bodies from different json files?

General discussion about the R.U.B.E editor
Post Reply
shefchenko
Posts: 2
Joined: Sun Oct 06, 2013 12:01 pm

Can we reuse the bodies from different json files?

Post by shefchenko »

Hello guys, I'm going to use R.U.B.E, but I'm not sure for something - when I create every level in separate json file, is there any way to reuse the bodies from different json files, or every time at the end of level I should delete bodies generated from rubeLoader and create them again in next level. Is there a better way for this situation when creating levels with RUBE? :?
And thank you iforce2d for great editor :)
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Can we reuse the bodies from different json files?

Post by iforce2d »

It sounds like you want to keep subsets of bodies in different files and load them in together. If so, there have been some other threads here about this which might be good to look at:

Loading two json:
viewtopic.php?f=6&t=176

How to import a body set from another b2dworld?:
viewtopic.php?f=6&t=153

Make some bodies unload:
viewtopic.php?f=6&t=188

If that's not what you meant, maybe you could say what you mean by 'better' way. Box2D has no way to transfer existing bodies between worlds directly, so the only way is by creating them afresh in the new world.
shefchenko
Posts: 2
Joined: Sun Oct 06, 2013 12:01 pm

Re: Can we reuse the bodies from different json files?

Post by shefchenko »

I will look these threads now, and yes, this is what I mean. So I can't reuse bodies from one world to another :( Thanks for reply.
Post Reply