espace Posted January 7, 2017 Share Posted January 7, 2017 hi, i have this array : this.name_opponent=["Albert","Luc","Gerard","Ros","killthegame","No225","unreal"] and i use this function to find a opponent. i believe that integerInRange don't choose the same but it's not the case. for (var i = 0; i < 2; i++) { this.opponent[i]=game.rnd.integerInRange(0,this.name_opponent.length) } wich function do that ? thanks Link to comment Share on other sites More sharing options...
samme Posted January 7, 2017 Share Posted January 7, 2017 One method is Phaser.ArrayUtils.shuffle(arr).slice(0, 3) Théo Sabattié and Befive.Info 2 Link to comment Share on other sites More sharing options...
espace Posted January 9, 2017 Author Share Posted January 9, 2017 thanks and happy new year 2017! Link to comment Share on other sites More sharing options...
Recommended Posts