Nikow Posted July 2, 2015 Report 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 Quote Link to comment Share on other sites More sharing options...
drhayes Posted July 2, 2015 Report 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. Quote Link to comment Share on other sites More sharing options...
Nikow Posted July 3, 2015 Author Report Share Posted July 3, 2015 Is it the only way ? Quote Link to comment Share on other sites More sharing options...
drhayes Posted July 6, 2015 Report Share Posted July 6, 2015 Probably not... but why do you ask? Quote Link to comment Share on other sites More sharing options...
Nikow Posted July 7, 2015 Author Report 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.