File tree Expand file tree Collapse file tree
src/gameobjects/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,6 +87,15 @@ var Animation = new Class({
8787 */
8888 this . nextAnim = null ;
8989
90+ /**
91+ * A queue of keys of the next Animations to be loaded into this Animation Controller when the current animation completes.
92+ *
93+ * @name Phaser.GameObjects.Components.Animation#nextAnimsQueue
94+ * @type {Array }
95+ * @default []
96+ */
97+ this . nextAnimsQueue = [ ] ;
98+
9099 /**
91100 * Time scale factor.
92101 *
@@ -321,7 +330,11 @@ var Animation = new Class({
321330 key = key . key ;
322331 }
323332
324- this . nextAnim = key ;
333+ if ( this . nextAnim === null ) {
334+ this . nextAnim = key ;
335+ } else {
336+ this . nextAnimsQueue . push ( key ) ;
337+ }
325338
326339 return this . parent ;
327340 } ,
@@ -850,7 +863,7 @@ var Animation = new Class({
850863 {
851864 var key = this . nextAnim ;
852865
853- this . nextAnim = null ;
866+ this . nextAnim = this . nextAnimsQueue . length > 0 ? this . nextAnimsQueue . shift ( ) : null ;
854867
855868 this . play ( key ) ;
856869 }
You can’t perform that action at this time.
0 commit comments