Creating separate objects in RUBE

General discussion about the R.U.B.E editor
rileyrg
Posts: 54
Joined: Sun Jul 19, 2015 11:42 am

Re: Creating separate objects in RUBE

Post by rileyrg »

Using JSON not really an option with the rube loader in libgdx. Sure I can import and add to scene but I cant manipulate the json I think. That said I'm a java noob and all the json parsing done in the loader is all a little black magic to me (The b2djson loader cant be used with libgdx).
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Creating separate objects in RUBE

Post by iforce2d »

rileyrg wrote:The b2djson loader cant be used with libgdx.
I think having a version of b2djson that uses the libgdx Box2D setup instead of jbox2d would solve most of your problems right? If you know how to create Box2D things in libgdx normally (without any RUBE stuff) then it should not be too much trouble to replace the parts of b2djson that use jbox2d, with the libgdx version. The actual parsing of JSON and handling of the file structure will be no different.
rileyrg
Posts: 54
Joined: Sun Jul 19, 2015 11:42 am

Re: Creating separate objects in RUBE

Post by rileyrg »

Yeah, I was thinking that but I was a bit caught in the lights so to speak. Its on my list for further down the road. thanks.
rileyrg
Posts: 54
Joined: Sun Jul 19, 2015 11:42 am

Re: Creating separate objects in RUBE

Post by rileyrg »

Just as an after thought, using the rube loader for libgdx "loader.addScene" is pretty non functional too since you dont know what bodies etc were actually added - so in a game character constructor you need to go through some hoops to use addScene : I would guess something like mark all bodies in the scene as "old" before spawning a new body with addScene then find the one body where it isnt "old" (custom property) and thats your newly imported body for your game character. In other words the libgdx implementation is somewhat lacking for anything where there are game characters spawned. As per a previous post it seems porting the b2djson importer is the most sensible option.
Post Reply