locomotive Posted November 18, 2018 Share Posted November 18, 2018 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 More sharing options...
Olf Posted November 20, 2018 Share Posted November 20, 2018 Hi, You add the event once with the evaluated value of "Phaser.Math.Between". Once created, the looped event will not change, its delay stay the same. I think you could add a simple event that adds itself on callback, with a new delay, by providing the appropriate context. samme and locomotive 1 1 Link to comment Share on other sites More sharing options...
locomotive Posted December 1, 2018 Author Share Posted December 1, 2018 That did the job , i am very thankful Link to comment Share on other sites More sharing options...
Recommended Posts