Jump to content

Random loop event ?


Nikow
 Share

Recommended Posts

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

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...