Nikow Posted July 2, 2015 Share Posted July 2, 2015 Hi, I''m trying to do a random loop event like this : cloudsGenerator = this.game.time.events.loop(Phaser.Timer.SECOND * game.rnd.integerInRange(1, 10), this.createCloud, this); But it's pick up a random number one time and use it for every loops... How can i do that ? Thanks Link to comment Share on other sites More sharing options...
drhayes Posted July 2, 2015 Share Posted July 2, 2015 In your createCloud function create the timer again with a different delay, e.g. "this.game.time.events.add(Phaser.Timer.SECOND * game.rnd.interInRange(1, 10)...". That will keep creating more events but each one will have a random delay from the last. Link to comment Share on other sites More sharing options...
Nikow Posted July 3, 2015 Author Share Posted July 3, 2015 Is it the only way ? Link to comment Share on other sites More sharing options...
drhayes Posted July 6, 2015 Share Posted July 6, 2015 Probably not... but why do you ask? Link to comment Share on other sites More sharing options...
Nikow Posted July 7, 2015 Author Share Posted July 7, 2015 Probably not... but why do you ask?Because i had already think about your solution and i didn't like it...But if it s the only way ^^i will keep it Link to comment Share on other sites More sharing options...
Recommended Posts