Search found 42 matches
- Thu Jun 13, 2013 9:20 am
- Forum: R.U.B.E discussion
- Topic: Instantiating bodies from a prototype in a RUBE document
- Replies: 12
- Views: 24555
Re: Instantiating bodies from a prototype in a RUBE document
Yes, I know the editor is more elegant but I am trying to do something the editor doesn't -- load new objects of my game based on named objects from the json. The good news is I finally got it to work :o I made the json a class object, so it's only instantiated once, upon the first load, and then mo...
- Wed Jun 12, 2013 8:34 am
- Forum: R.U.B.E discussion
- Topic: Instantiating bodies from a prototype in a RUBE document
- Replies: 12
- Views: 24555
Re: Instantiating bodies from a prototype in a RUBE document
Ugh... obviously it's read and written to different b2dJson objects. My barely born C++ is failing me...
- Wed Jun 12, 2013 7:37 am
- Forum: R.U.B.E discussion
- Topic: Instantiating bodies from a prototype in a RUBE document
- Replies: 12
- Views: 24555
Re: Instantiating bodies from a prototype in a RUBE document
I took your advice and left the world as is (defined in the .h of BasicRubeLayer) and run it, reading my Grass1.json file, which is an export of a rube scene with just one image connected to body. The image and body are there, connected, working perfectly. First step done. Now I need to save this, s...
- Tue Jun 11, 2013 4:51 pm
- Forum: R.U.B.E discussion
- Topic: Instantiating bodies from a prototype in a RUBE document
- Replies: 12
- Views: 24555
Re: Instantiating bodies from a prototype in a RUBE document
OK if I understand correctly, normally the world is created by the json.readFromFile method. But following your advice from above I have the option to give readFromFile my own world, so that if I'm adding bodies after the world is created they go into the same one -- the same world. At least that's ...
- Tue Jun 11, 2013 3:23 pm
- Forum: R.U.B.E discussion
- Topic: Instantiating bodies from a prototype in a RUBE document
- Replies: 12
- Views: 24555
Re: Instantiating bodies from a prototype in a RUBE document
Yes, it is cocos2d and I did put the setImagePositionsFromPhysicsBodies in my tick method. The strange thing is that if I let the RubeLayer use it's own m_world everything is good, but when I'm setting my own world only the image is showing up, but no body.
- Tue Jun 11, 2013 2:53 pm
- Forum: R.U.B.E discussion
- Topic: Instantiating bodies from a prototype in a RUBE document
- Replies: 12
- Views: 24555
Re: Instantiating bodies from a prototype in a RUBE document
So I followed the steps for modifying the readFromFile and the j2b2World methods, then went to my scene -- where I create my layers -- initialized a b2World there, and set it to my layers (so I can use the same b2World in different layers.) The images are loading OK, but they are not connected to th...
- Mon Jun 10, 2013 3:25 pm
- Forum: R.U.B.E discussion
- Topic: Saving world state using b2dJson
- Replies: 5
- Views: 9504
Re: Saving world state using b2dJson
Yeah, I get that. And I get the loading to work, including bodies and joints, created on the fly by the user. Nice. But I guess I'm living in parallel universes right now. One is my own in which I use the Rube generated C++ code -- and got stuck because some images aren't aligned correctly with thei...
- Mon Jun 10, 2013 1:03 pm
- Forum: R.U.B.E discussion
- Topic: Saving world state using b2dJson
- Replies: 5
- Views: 9504
Re: Saving world state using b2dJson
OK got it, need to set the readHumanFloats boolean in b2dJson to true.
- Mon Jun 10, 2013 11:42 am
- Forum: R.U.B.E discussion
- Topic: Saving world state using b2dJson
- Replies: 5
- Views: 9504
Re: Saving world state using b2dJson
Thanks. So I'm writing to a file and it comes out with alphanumeric values instead of the actual ones. Something like this: "fixture" : [ { "density" : "446DD5D5", "friction" : "3E4CCCCD", "name" : "fixture0", "polygon" ...
- Mon Jun 10, 2013 9:57 am
- Forum: R.U.B.E discussion
- Topic: Saving world state using b2dJson
- Replies: 5
- Views: 9504
Saving world state using b2dJson
I'm trying to save my game's state using the json tools in TouchJSON, which are used in RUBELayer. I'm attempting to save my world to a file (now that's how poetry should react to a changing culture!) by using this code, basically taken from BasicRubeLayer but using the write instead of the read: NS...