diff --git a/README.md b/README.md index 334d7244..1784f48b 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,10 @@ Phaser is everything we ever wanted from an HTML5 game framework. It will power Change Log ---------- -Version 1.0.5 (September 19th 2013) +Version 1.0.5 (In progress) * Fixed issue in FrameData.getFrameIndexes where the input array was being ignored. +* Added Math.numberArray - Returns an Array containing the numbers from min to max (inclusive), useful for animation frame construction. Version 1.0.4 (September 18th 2013) diff --git a/src/math/Math.js b/src/math/Math.js index 2995b4f8..1709e317 100644 --- a/src/math/Math.js +++ b/src/math/Math.js @@ -323,6 +323,26 @@ Phaser.Math = { } } + }, + + /** + * Returns an Array containing the numbers from min to max (inclusive) + * + * @param min The minimum value the array starts with + * @param max The maximum value the array contains + * @return The array of number values + */ + numberArray: function (min, max) { + + var result = []; + + for (var i = min; i <= max; i++) + { + result.push(i); + } + + return result; + }, /**