Page 1 of 1

Instantiable object as sub-scene

Posted: Tue Jan 01, 2013 10:34 am
by metalbass_92
Hi,

when i've seen the "Instantiable objects" feature on the voting page i thought that it could be implemented in terms of a whole rube scene, that way you would only need to refer to the file name and avoid all the redundant information between the various instanced objects.

I've also thought that storing world information in all of them would be quite a waste, right?

Btw way, i love the whole Voting thing!

Re: Instantiable object as sub-scene

Posted: Tue Jan 01, 2013 3:19 pm
by iforce2d
The 'instantiable object' would behave like a template that could be used to place many similar things around the scene, all referencing the same master object template. Editing the master object would cause all instances of that object in the scene to be changed. So in the .rube/.json file, there would be only one occurrence of the template itself, and a list of the locations that an object should be placed. I don't think there is anything redundant there.

Yes, I guess you could save these master objects in separate files, then they could be shared between different scenes. Right now the top level object in a .rube file is expected to be the world, but in future perhaps this could be modified to allow loading of individual bodies, fixtures, images... and 'objects'.

Re: Instantiable object as sub-scene

Posted: Tue Jan 01, 2013 10:45 pm
by metalbass_92
I was talking about redundancy because i've been using a cocos2d with box2d tool that uses definitions of bodies from a file and then it includes those definitions as a copy everywhere they are used in the level.

I think it's the easier way to implement, so i was (kinda) offering a better way than that.
The way you're taking sounds pretty good to me :lol: