【发布时间】:2018-04-09 01:56:59
【问题描述】:
我在我的游戏中使用 6 帧动画来进行事件。它有固定的播放顺序。
Array<TextureAtlas.AtlasRegion> anim=new Array<TextureAtlas.AtlasRegion>();
anim = game.playAtlas.findRegions(RegionNames.FEATHER_ANIMATION);
TextureRegion[] ftr = {anim.get(0),anim.get(1),anim.get(2),anim.get(3),anim.get(4),anim.get(5)};
featherAnimation = new Animation(0.1f,ftr);
featherAnimation.setPlayMode(PlayMode.NORMAL);
我只想运行这个动画一次(这意味着它应该播放第 0 帧到 最后一帧,然后应该停止),当特定的布尔值为真时。
播放完最后一帧后,它应该停止并使布尔值也为假。
我就是这样做的
if (featherBool && egg.isEggAtNest()) {
featherTexture = featherAnimation.getKeyFrame(animationTime, true);
batch.draw(featherTexture, egg.getX() - featherTexture.getRegionWidth() / 2, fx.getY());
featherBool = false;
}
但这并没有达到我想要的效果。
帧的顺序不是我指定的。 另外,播放 0 到 5th 帧后如何停止动画?
【问题讨论】: