对不起,如果这个问题之前被问到。我已经搜索过,但我没有找到任何关于此的线索,所以我在这里发布问题。AnimatedSprite显示大小错误
我真的是Andengine的新手。我正在尝试加载一个平铺雪碧,并用它创建一个动画。 这里是我的代码:
public void loadGameResources() {
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/player/");
mSapoTextureAtlas = new BitmapTextureAtlas(mActivity.getTextureManager(),256,178,TextureOptions.DEFAULT);
mPlayerDownITiledTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(mPlayerTextureAtlas, mActivity.getAssets(), "player.png", 0,0,3,1);
mPlayerTextureAtlas.load();
}
我想到的是,玩家可以像走了一些行动,但我不知道。请参阅附件截图以查看实际结果。我认为我的代码将原始纹理分成3部分,而不是在第一行分割3个精灵。
请看看并帮我解决这个问题。非常感谢!
这里是我如何创建动画:
AnimatedSprite player= new AnimatedSprite(100,100,40,40,mResourceManager.mPlayerDownITiledTextureRegion,mVertexBufferObjectManager);
player.animate(500);
player.setZIndex(100);
attachChild(sapo);
谢谢你的回应,Harry。我已经按照你的描述编辑了我的代码,但没有任何变化。我会深入研究一下。 – 2015-04-01 12:43:13
请参阅编辑答案,您需要在玩家精灵中加载行数和列数的纹理。 – Harry 2015-04-01 12:52:22
非常感谢你,哈利。现在问题解决了。我必须加载整个地图集,而不是只加载一行。 – 2015-04-01 14:36:09