Updated DynamicTexture.setPixel, added GameMath.shuffleArray, fixed Animation.frame and created a few new tests

This commit is contained in:
Richard Davey
2013-05-18 03:05:28 +01:00
parent 55568592b5
commit 53aa43566e
21 changed files with 529 additions and 95 deletions
+18
View File
@@ -1003,6 +1003,24 @@ module Phaser {
return ax * bx + ay * by;
}
/**
* Shuffles the data in the given array into a new order
* @param array The array to shuffle
* @return The array
*/
public shuffleArray(array) {
for (var i = array.length - 1; i > 0; i--)
{
var j = Math.floor(Math.random() * (i + 1));
var temp = array[i];
array[i] = array[j];
array[j] = temp;
}
return array;
}
}