Skip to content

Commit cf26f68

Browse files
committed
Added Math.numberArray
1 parent 47834ad commit cf26f68

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ Phaser is everything we ever wanted from an HTML5 game framework. It will power
3535
Change Log
3636
----------
3737

38-
Version 1.0.5 (September 19th 2013)
38+
Version 1.0.5 (In progress)
3939

4040
* Fixed issue in FrameData.getFrameIndexes where the input array was being ignored.
41+
* Added Math.numberArray - Returns an Array containing the numbers from min to max (inclusive), useful for animation frame construction.
4142

4243

4344
Version 1.0.4 (September 18th 2013)

src/math/Math.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,26 @@ Phaser.Math = {
323323
}
324324
}
325325

326+
},
327+
328+
/**
329+
* Returns an Array containing the numbers from min to max (inclusive)
330+
*
331+
* @param min The minimum value the array starts with
332+
* @param max The maximum value the array contains
333+
* @return The array of number values
334+
*/
335+
numberArray: function (min, max) {
336+
337+
var result = [];
338+
339+
for (var i = min; i <= max; i++)
340+
{
341+
result.push(i);
342+
}
343+
344+
return result;
345+
326346
},
327347

328348
/**

0 commit comments

Comments
 (0)