liorfrenkel Posted January 16, 2016 Share Posted January 16, 2016 Hi all, I want to do something simple, tell a Phaser.Timer to: repeat 10 times in speed A, wait A seconds then repeat 3 times in speed B, wait B seconds then repeat X times in speed C wait C seconds etc... Is there a simple way of doing that? thanks! Lior Link to comment Share on other sites More sharing options...
liorfrenkel Posted January 16, 2016 Author Share Posted January 16, 2016 I ended up avoiding the repeat function and doing something like that: var speedData = [ { spawnInterval: 5000, spawnTimes: 2 }, { spawnInterval: 1000, spawnTimes: 5 }, etc... ] var nextDuration = 0; speedData.forEach((speedData) => { for (var i = 0; i < speedData.spawnTimes; i++) { this.timer.add(nextDuration, THE_CALLBACK, this); nextDuration += speedData.spawnInterval; } }, this); Link to comment Share on other sites More sharing options...
Recommended Posts