mirror of
https://github.com/photonstorm/phaser
synced 2024-11-28 07:31:11 +00:00
Allow chaining of multible animations
With this commit it is possible to chain more than one animation together for example: this.mole.anims.play('digging',true).anims.chain('lifting').anims.chain('looking').anims.chain('lowering'); This commit introduces a property nextAnimsQueue. It holds all additional nextAnim-Keys in the order the chain()-method was called. It is handed over to the nextAnim-Property in the stop()-method.
This commit is contained in:
parent
b00acb1838
commit
a39199849e
1 changed files with 15 additions and 2 deletions
|
@ -87,6 +87,15 @@ var Animation = new Class({
|
|||
*/
|
||||
this.nextAnim = null;
|
||||
|
||||
/**
|
||||
* A queue of keys of the next Animations to be loaded into this Animation Controller when the current animation completes.
|
||||
*
|
||||
* @name Phaser.GameObjects.Components.Animation#nextAnimsQueue
|
||||
* @type {Array}
|
||||
* @default []
|
||||
*/
|
||||
this.nextAnimsQueue = [];
|
||||
|
||||
/**
|
||||
* Time scale factor.
|
||||
*
|
||||
|
@ -321,7 +330,11 @@ var Animation = new Class({
|
|||
key = key.key;
|
||||
}
|
||||
|
||||
this.nextAnim = key;
|
||||
if(this.nextAnim === null){
|
||||
this.nextAnim = key;
|
||||
} else {
|
||||
this.nextAnimsQueue.push(key);
|
||||
}
|
||||
|
||||
return this.parent;
|
||||
},
|
||||
|
@ -850,7 +863,7 @@ var Animation = new Class({
|
|||
{
|
||||
var key = this.nextAnim;
|
||||
|
||||
this.nextAnim = null;
|
||||
this.nextAnim = this.nextAnimsQueue.length > 0 ? this.nextAnimsQueue.shift() : null;
|
||||
|
||||
this.play(key);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue