0

I found great tool to make shapes. But the example how to load the shape for javascript. He wrote

Note: the following code snippets are extracted from the loader-libgdx-demo project. They are written in Java, and target the LibGDX game framework. However, they should be easy to understand, and easy to port to any other language.

But I cannot find it easy at all :)

private void createBottle() {
    // 0. Create a loader for the file saved from the editor.
    BodyEditorLoader loader = new BodyEditorLoader(Gdx.files.internal("data/test.json"));

    // 1. Create a BodyDef, as usual.
    BodyDef bd = new BodyDef();
    bd.position.set(0, 0);
    bd.type = BodyType.DynamicBody;

    // 2. Create a FixtureDef, as usual.
    FixtureDef fd = new FixtureDef();
    fd.density = 1;
    fd.friction = 0.5f;
    fd.restitution = 0.3f;

    // 3. Create a Body, as usual.
    bottleModel = world.createBody(bd);

    // 4. Create the body fixture automatically by using the loader.
    loader.attachFixture(bottleModel, "test01", fd, BOTTLE_WIDTH);
}

So what to do with this line:

BodyEditorLoader loader = new BodyEditorLoader(Gdx.files.internal("data/test.json"));

BodyEditorLoader should be in jar file. But javascript cannot use this. Or I have to open jar file itselt and recode in javascritp?

Or maybe there exists something like this for javascritpt?

Edited by McLaren

2
Contributors
4
Replies
11
Views
4 Years
Discussion Span
Last Post by McLaren
0

this flahs tool sucks - uses full CPU when moving mouse pointer. And exporting I think is only usfull that you can copy the coordinates. But I did not experiment much, because of annoing lag. The JAVA tool was much better for drawing those shapes.
Isn't there decent to to draw the shapes for javascript? Or convert from that JAVA json whihc it generates?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.