0
這是我的代碼:Libgdx spine2d骨骼動畫
遊戲初始化:
playerAtlas = new TextureAtlas(Gdx.files.internal("spineboy.atlas"));
json = new SkeletonJson(playerAtlas);
playerSkeletonData = json.readSkeletonData(Gdx.files.internal("spineboy.json"));
playerAnimationData = new AnimationStateData(playerSkeletonData);
batch = new SpriteBatch();
skeletonRenderer = new SkeletonRenderer();
skeleton = new Skeleton(playerSkeletonData);
animationState = new AnimationState(playerAnimationData);
animationState.setAnimation(0, "walk", true); // trackIndex, name, loop
渲染:
animationState.update(Gdx.graphics.getDeltaTime());
animationState.apply(skeleton);
batch.begin();
skeletonRenderer.draw(batch, skeleton);
batch.end();
Gdx.app.log("rendering", "x" +skeleton.getX());
Gdx.app.log("rendering", "y"+skeleton.getY());
skeleton.setPosition(300, 300);
,由於某種原因,我不能讓我的動畫展現出來。
我從這裏得到這個代碼,並複製它: https://gamedev.stackexchange.com/questions/98890/implementing-spine-animations-in-libgdx
我無法弄清楚,爲什麼動畫不能正常呈現!
任何人都可以請幫忙嗎?
謝謝!我認爲這是你第二次回答我的問題之一,並有一個很好的答案!你真棒! –