2017-02-05 4 views
0

私はフェイザーを使用してアニメーションを連鎖しようとしています。フェイザーアニメーションヘルプ - 連鎖アニメーションを一緒に

intro0が終了したら、intro1で定義されたアニメーションを再生する必要があります。 しかし、イントロ1のアニメーションはループを維持します。既存のアニメーションを停止して新しいアニメーションを開始する方法が必要です。

intro1でthis.player.animations.stopを使用すると、すべてのアニメーションが停止します。アイドルアニメーションが実行されない

誰でも手助けできますか?無限のアニメーションとスプライトがありますが、補間イベントは、現在のアニメーションが終了を終了し、スプライトが破壊されている必要があり、それを終えた後、別のアニメーションを開始したとき:

intro0: function() { 
    this.player.animations.play("run", 9, true); 
    var s = this.game.add.tween(this.player); 
    s.to({ y: 300,x:192 }, 3000, null) 
    s.start(); 
    s.onComplete.add(this.intro1, this); //Which uses the Signals retains scope 

}, 

intro1: function() { 
    this.player.animations.play("idle", 9, false); 
}, 

答えて

0

私は理解しています。

player.animations.add('run', [0,1,2,3]); 
    player.animations.add('idle', [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]); 
    player.animations.play('run', 10, true); 

    var s = game.add.tween(player); 
    s.to({ y: 300,x:192 }, 3000, null); 
    s.start(); 
    s.onComplete.add(function() { 
         player.animations.stop(); 
         player.animations.play('idle', 9, false, true); 
        }, this); 
:あなたは一定数のフレームをアニメーション化する場合は、次の操作を行うことができます

s.onComplete.add(function() { 
        //The third parameter indicates whether to stop the current animation 
        player.loadTexture('texture', 0, true); 
        player.animations.add('idle'); 
        //The fourth parameter indicates whether the sprite should be killed after the animation is finished 
        player.animations.play('idle', 9, false, true); 
       }, this); 

:新しいアニメーションは、私はあなたがloadTexture()を使用することができたと別のスプライトの場合

関連する問題