2
votes

I am trying to get the hang of game development using LibGDX, so far I am understanding everything of it since it's basic Java with a good use of interfaces and super classes.

What I'm struggling with is with the incorporation of graphics into the LibGDX project, I am using Tiled to create maps which I understand how it works and how to render them.

I also started to get into Box2D for physics and I was able to wrap my maps (tiled..) with Box2D.

The problem comes when I try to import a project from Spine, I visited the following link: https://github.com/EsotericSoftware/spine-runtimes/tree/master/spine-libgdx and sure they have documentation there....but for someone getting started I believe they assume you know everything, and as of right now the Box2D example that they have doesn't work because of the new BoundingBoxAttachment..

My question basically is: is there any recent "tutorial" on how to use these 3 tools (libgdx, box2d and spine) from scratch and not separate?

I won't post any specific code because what I want is more of a guidance rather than a code troubleshoot.

Thanks for any cooperation in advance.

1
Sounds like a question for the Spine forum: esotericsoftware.com/forum - iforce2d

1 Answers

1
votes

I guess it was a matter of truly diving in the code, after a lot of studying the structure of the json that gets generated with Spine and really learning my way around Box2D I was able to control the camera at my will and using the loop provided in the sample codes for spine

    // Position each attachment body.
    for (Slot slot : skeleton.getSlots()) {
        if (!(slot.getAttachment() instanceof Box2dAttachment)) continue;
        Box2dAttachment attachment = (Box2dAttachment)slot.getAttachment();
        if (attachment.body == null) continue;
        attachment.body.setTransform(slot.getBone().getWorldX(), slot.getBone().getWorldY(), slot.getBone().getWorldRotation()
            * MathUtils.degRad);
    }

I was able to get each attachment and generate the attachments, since the example doesn't work I guess it just need tweaking.