Page 1 of 1
How can I use rube as my cocos2d level editor?
Posted: Tue Feb 19, 2013 11:04 am
by zerofield
Hi, I'm new to rube. I was planning to use rube as my level editor. But after watching the tutorials, I found that the size of images are scaled in rube, which would cause a lot trouble to make games with cocos2d. Will rube offer a function like physics editor that requires a ptm ratio to work with meter and pixel?
Re: How can I use rube as my cocos2d level editor?
Posted: Wed Feb 20, 2013 10:24 am
by iforce2d
Could you be a bit more specific about what causes a lot of trouble with cocos2d? I'm not too familiar with cocos2d, and I have yet to make a sample loader, so maybe you could give me a tip about what problems I might come across.
Take a look at this thread too, might have some relevant info:
viewtopic.php?f=7&t=40
Re: How can I use rube as my cocos2d level editor?
Posted: Thu Feb 21, 2013 11:40 pm
by zerofield
Thanks, the link is useful. Could you add a pixel mode in future? In pixel mode, unit is pixel, images are not scaled and a PTM ratio which is used to convert pixel to meter is required. A pixel mode would be very useful for making games because meter is too tiny and not very precise compared with pixel. Tools like Physics Editor and Vertex Helper are really useful to trace the shape of a sprite, but they can't be used to design a level. Life would be easier if a pixel mode is added.
Just imagine that I have my game assets ready and drag into rube. After that I set the PTM and trace the shape of images. Then I can design the level and export it. The exported file records the pixel for each vertex. In game program, sprites' position and body position are converted with PTM.
Re: How can I use rube as my cocos2d level editor?
Posted: Fri Feb 22, 2013 1:43 am
by iforce2d
I think you can set up the equivalent of the 'pixel mode' you are talking about with the script suggestion in the thread I linked to. This is still a little inconvenient in that you have to apply the right scale for each image when you add it to the scene, so I am thinking about adding some hooks to automatically run a script at certain events, for example after an image is dropped into the scene, before/after export etc. Hopefully that would streamline the workflow more.
Re: How can I use rube as my cocos2d level editor?
Posted: Fri Feb 22, 2013 9:58 am
by zerofield
That would be great! I have one more question: How can I put a body with square fixture on other bodies or next to bodies without overlapping? For now I have to compare vertices' position and move the centre point if overlapping happens and the value are really small too calculate. Is there any easy way to position bodies without too much effort? I want bodies being as close as possible.
Re: How can I use rube as my cocos2d level editor?
Posted: Fri Feb 22, 2013 10:29 am
by iforce2d
If the fixtures on the bodies are regular dimensions, you might be able to use the Ctrl key while moving to translate in discrete increments. You can change the increment size in the options dialog.
Another thing I often do when the need arises to place things close together, is simply to zoom right in (you can use Shift+RMB to drag an area to zoom into quickly). Holding Shift while translating lets you move things very slowly. Are you trying to make a stack of boxes that does is already settled when the simulation starts?
Re: How can I use rube as my cocos2d level editor?
Posted: Fri Feb 22, 2013 11:01 am
by zerofield
Yep, I want all bodies being very stable. Users won't see boxes slightly move up and down.