11
22var Class = require ( '../../utils/Class' ) ;
33var Set = require ( '../../structs/Set' ) ;
4+ var GetObjectValue = require ( '../../utils/object/GetObjectValue' ) ;
45var Actions = require ( '../../actions/' ) ;
56var Sprite = require ( '../sprite/Sprite' ) ;
67
@@ -97,10 +98,11 @@ var Layer = new Class({
9798 * @param {boolean } [exists=false] - The default exists state of the Sprite.
9899 * @return {array } An array containing all of the Sprites that were created.
99100 */
100- createMultiple : function ( quantity , key , frame , visible )
101+ createMultiple : function ( quantity , key , frame , options )
101102 {
102103 if ( frame === undefined ) { frame = null ; }
103- if ( visible === undefined ) { visible = true ; }
104+
105+ var visible = GetObjectValue ( options , 'visible' , true ) ;
104106
105107 if ( ! Array . isArray ( key ) )
106108 {
@@ -126,6 +128,25 @@ var Layer = new Class({
126128 } ) ;
127129 } ) ;
128130
131+ // Post-creation options:
132+
133+ var x = GetObjectValue ( options , 'x' , 0 ) ;
134+ var y = GetObjectValue ( options , 'y' , 0 ) ;
135+ var stepX = GetObjectValue ( options , 'stepX' , 0 ) ;
136+ var stepY = GetObjectValue ( options , 'stepY' , 0 ) ;
137+
138+ this . setXY ( x , y , stepX , stepY ) ;
139+
140+ var rotation = GetObjectValue ( options , 'rotation' , 0 ) ;
141+ var stepRotation = GetObjectValue ( options , 'stepRotation' , 0 ) ;
142+
143+ this . setRotation ( rotation , stepRotation ) ;
144+
145+ var alpha = GetObjectValue ( options , 'alpha' , 1 ) ;
146+ var stepAlpha = GetObjectValue ( options , 'stepAlpha' , 0 ) ;
147+
148+ this . setAlpha ( alpha , stepAlpha ) ;
149+
129150 return entries ;
130151 } ,
131152
@@ -167,6 +188,13 @@ var Layer = new Class({
167188 return this ;
168189 } ,
169190
191+ incAlpha : function ( value , step )
192+ {
193+ Actions . IncAlpha ( this . children . entries , value , step ) ;
194+
195+ return this ;
196+ } ,
197+
170198 incX : function ( value )
171199 {
172200 Actions . IncX ( this . children . entries , value ) ;
@@ -216,6 +244,13 @@ var Layer = new Class({
216244 return this ;
217245 } ,
218246
247+ setAlpha : function ( value , step )
248+ {
249+ Actions . SetAlpha ( this . children . entries , value , step ) ;
250+
251+ return this ;
252+ } ,
253+
219254 setRotation : function ( value , step )
220255 {
221256 Actions . SetRotation ( this . children . entries , value , step ) ;
@@ -237,9 +272,9 @@ var Layer = new Class({
237272 return this ;
238273 } ,
239274
240- setXY : function ( x , y )
275+ setXY : function ( x , y , stepX , stepY )
241276 {
242- Actions . SetXY ( this . children . entries , x , y ) ;
277+ Actions . SetXY ( this . children . entries , x , y , stepX , stepY ) ;
243278
244279 return this ;
245280 } ,
0 commit comments