Jump to content

looped timed event with random delay


locomotive
 Share

Recommended Posts

Hello ,

i am new to building games , started my phaser3 journey one week ago ,

i am trying to make a looped timed event run multiple times , each time a different delay ,

so for example  instead of making  the event run every 5 sec as this line of code does :

phonecall = this.time.addEvent({ delay: 5000,  loop: true, callback: onEvent, callbackScope: this });

i need it to run at random intervals from 5 to 30 secs ( ex : first time 5 sec second time 10 sec third time 7 sec) any value between the interval i set  , i tried to do this :

    	phonecall = this.time.addEvent({ delay: Phaser.Math.Between(5000,30000),  loop: true, callback: onEvent, callbackScope: this });

but it seems that its not working ..

sorry for my bad use of English  , 

thanks

Link to comment
Share on other sites

  • 2 weeks later...
 Share

  • Recently Browsing   0 members

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