smerzlia

Hi,
I think the answer to this is YES (from website docs on runtimes )- but just wanted to check before I buy the product.....

I want to use the Spine libgdx runtime to get a sprite character to move their arm and follow another object/monster precisely, without drawing every arm position precisely (the traditional approach with sprites, including compositional sprites).

Is there an API in the runtime to do this?

So in pseudo-code:

double angle = getMonsterPositionAsAnAngle()
// armSprite uses some sort of Spine API
armSprite.rotateAtJoint(angle)

I know spine can output pngs, texture atlases etc. That's not what I am after - but to avoid having to create lots of frames of main character pointing gun down/up/left/right/top-left/etc.

Thanks.
smerzlia
  • 記事: 8

Mario

The answer is indeed yes :) We have an example project that demonstrates exactly what you want, i.e. a 2D character that runs left/right and simultaniously aims at something https://github.com/EsotericSoftware/spine-superspineboy

The code for aiming can be found here: https://github.com/EsotericSoftware/spine-superspineboy/blob/master/src/com/esotericsoftware/spine/superspineboy/PlayerView.java#L111
アバター
Mario

Mario
  • 記事: 2730

smerzlia

Thanks Mario. I got it to work in a sample project.
smerzlia
  • 記事: 8


Return to Runtimes