Jump to content

RUBE Editor and Box2d


Recommended Posts

Hi all,


I have just purchased the box2d plugin, which is awesome. I have also been looking at the RUBE editor, which looks like an ideal place to build your and test your box2d world.


I'm just getting to grips with physics engines and I was wondering:


  •  How you would go about loading a world created in RUBE into Phaser?
  •  Can you import elements, like a Body with Fixtures, into Phaser?


Any help appreciated or if someone can point me in the right direction.



Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...

Have you checked out the examples and tutorials? Basically, in preload function you load the exported RUBE JSON file, like this:

game.load.text('rubeScene', 'rubeScene.json');

In create function you initialize the scene:

rubeScene = new Phaser.Physics.Box2D.RubeScene('rubeScene');rubeScene.load(0, 0, function () {  yourSprite = rubeScene.getSprite('nameOfTheImageYouSetInRUBE');}

You can also access bodies, fixtures, joints, etc. in similar way (i.e. by 'rubeScene.get(Body|Fixture|Sprite|Joint|...)').

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...