mirror of
https://github.com/wassname/phaser.git
synced 2026-08-09 12:20:34 +08:00
Updated DynamicTexture.setPixel, added GameMath.shuffleArray, fixed Animation.frame and created a few new tests
This commit is contained in:
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user