http://danecekpilar.borec.cz/
Hi guys.
during the development in Phaser i found out, that there is no simple online editor for Making Physics bodies for P2 physics in Phaser.
So i came up with an simple idea. To do a simple online body editor to make json files for Phaser.
I know its super simple and it could do much more things as other desktop body editors can do, but when you want just simple body in two minutes, i think its a good way.
I took me less than two hour to do it, so dont judge it for bad appearance and not efficient solutions for the algorithm.
Maybe ill do things like more bodies in one json file, or auto edge-tracer adn stuff like that, but fell free to comment and come up with your ideas to improve it for the future.
So please, if have have anything to say to this, comment below, i would be pleased.
http://danecekpilar.borec.cz

I found quite similar solution, but with less code.
You just load your json file with "game.load.json("your_key","your_path");"
than set a global variable, that will be avalible for the whole programme. "var your-var;"
in the create method, save the json data to that variable "your-var = game.cache.getJSON("your_key");"
than here comes the function, i tried to do it with little bit of code, so i know that this function could be done better, but it has the main functionality:
*only works for json file made in physics_editor* for other types of json file, you have to rebiuld the function little bit.
function resize_polygon(character_key, scale){
shape = vour-var[character_key];
for (var i = 0; i < shape.length; i++) {
console.log(shape["shape"]); for(var j = 0;j < shape["shape"].length;j++){ shape["shape"][j] = shape["shape"][j]*scale;
}
} }
when you want to call the function, just use name of the sprite polygon coords name and scale as parameters.
you can use this fucntion as many times as you want.
than when you want to apply the polygons on your sprite, call the function like this:
"your_sprite.body.loadPolygon(null,your-var["name of the sprite used in the json file"]);
Hope i helped you little bit.