我对ANDENGINE很新颖。我正试图在当时的动画精灵上工作,那时候我有一个精灵动画对象,如image1
,image2
,image3
。在这些图像中,将执行一系列动画。现在在动画的ANDENGINE中使用TiledTextureRegion
,它只使用一个图像,其中给出了精灵动画,就像下面的图像一样,所以有什么方法可以使用图像序列来运行精灵动画。我对它进行了很多搜索,但似乎很少有关于该主题的信息,因为andengine放松了一些,但当时我必须这样做,而且我无法考虑如何启动或使用任何方法来实现此目的。Image Squences AndEngine
1
A
回答
1
一样多,我得到了你的问题,你不能用几个单独的图像播放动画。您应该只使用一个平铺图像来实现单个精灵的动画。上面的图片可以播放运行动画。为什么你搜索结合个人精灵动画?
对于上面图像的动画可以使用
yourSprite.animate(new long[] { 110, 110, 110, 110 ,110 }, 0, 4, true);
在该动画的方法你有四个参数。第一个参数负责每个平铺动画持续时间,第二个参数(这里:0)是平铺精灵的起始索引, 第三个参数(这里:4)是平铺的最后一个索引。第四个参数是循环动画的布尔值。
注意:我忽略你的第二行在上面的图像平铺在这里。 快乐编码:)
+1
这只有99%是真的。你可以用任意数量的“ITextureRegion”(它本身可以是“TiledTextureRegion”(开始!!!))提供一个''TiledTextureRegion''。请参阅:https://github.com/nicolasgramlich/AndEngine/blob/GLES2-AnchorCenter/src/org/andengine/opengl/texture/region/TiledTextureRegion.java#L30 – 2013-04-29 17:47:25
1
您可以从文件夹创建TiledTextureRegion。下面的示例加载文件夹“person”中的所有图像,因为它是一个人的步行周期。
BuildableBitmapTextureAtlas texture = new BuildableBitmapTextureAtlas(engine.getTextureManager(), 256, 64);
personTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAssetDirectory(texture, context.getAssets(), "person");
try {
texture.build(new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 1, 4));
texture.load();
} catch (TextureAtlasBuilderException e) {
Debug.e(e);
}
图像将按字母顺序添加。
相关问题
- 1. AndEngine SceneTouchEvent
- 2. 在andengine
- 3. Matlab`image(image)= - 1`?
- 4. Andengine Demo Nullpointer
- 5. OpenCV mat * image =(mat *)image
- 6. image/pjpeg和image/jpeg
- 7. background-image url response image
- 8. 的Android AndEngine analogController
- 9. Debug Draw Andengine
- 10. AndEngine beginContact功能
- 11. Andengine的Performclick
- 12. 如何在andengine
- 13. AndEngine Text.setText not working
- 14. AndEngine Ease功能
- 15. Andengine fo ndroid
- 16. AndEngine的Java Hashtable
- 17. andengine中的runOnUpdateThread
- 18. AndEngine GLES2 ScrollContainer
- 19. AndEngine位置
- 20. andengine空TextureRegion
- 21. andengine mousejoint withouth gravity
- 22. andengine姿态
- 23. Android AndEngine GameNot Running
- 24. 游戏在AndEngine
- 25. AndEngine:使用PIXEL_TO_METER_RATIO
- 26. Andengine- autoparallaxbackground-背景
- 27. AndEngine for Android 2.3
- 28. System.gc将工作在Android(Andengine)
- 29. CSS image-orientation:from-image;不工作
- 30. HTML Mouseover image over image推出
顺便说一句,你的序列中的第一张和最后一张图像看起来完全相同。所以你可能只需要其中的一个。 – 2013-04-29 17:48:23