From cf26f686936e72434b6fcc8f7d2e70776b4b72fd Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Wed, 18 Sep 2013 14:07:37 +0100 Subject: [PATCH] Added Math.numberArray --- README.md | 3 ++- src/math/Math.js | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) 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; + }, /**