1
我有動畫平鋪雪碧。第一次我想動畫4至7幀4時間。在下一瞬間,我想不斷移動0到3幀。我使用此代碼做我的工作,但不能完成它AndEngine中的動畫平鋪雪碧
playerSprite.animate(new long[] { 100,100,100,100}, 4, 7, 2);
playerSprite.animate(new long[] { 100,100,100,100}, 0, 4, true);
我有動畫平鋪雪碧。第一次我想動畫4至7幀4時間。在下一瞬間,我想不斷移動0到3幀。我使用此代碼做我的工作,但不能完成它AndEngine中的動畫平鋪雪碧
playerSprite.animate(new long[] { 100,100,100,100}, 4, 7, 2);
playerSprite.animate(new long[] { 100,100,100,100}, 0, 4, true);
根據我的建議,你必須使用動畫偵聽器來達到此目的。當第一個動畫完成其工作時,你必須開始另一個動畫。以下是可幫助您的代碼片段。
animate(new long[] {100,100,100,100}, 4, 7, false, new IAnimationListener() {
@Override
public void onAnimationStarted(AnimatedSprite pAnimatedSprite,
int pInitialLoopCount) {
}
@Override
public void onAnimationLoopFinished(AnimatedSprite pAnimatedSprite,
int pRemainingLoopCount, int pInitialLoopCount) {
}
@Override
public void onAnimationFrameChanged(AnimatedSprite pAnimatedSprite,
int pOldFrameIndex, int pNewFrameIndex) {
}
@Override
public void onAnimationFinished(AnimatedSprite pAnimatedSprite) {
// start your second animation
}
});
使用這種方式,你有打電話給你的其他動畫onAnimationFinished方法
我無法理解「動畫4至7架4的時間。」你能否給這個問題添加一些更多的細節? – 2013-04-26 16:54:57