I had posted a question on stack overflow for an issue I have with starting followers.
I am using Phaser 3 and want to start a number of followers along a path. I can get this to work; however, I wanted to start then evenly spaced apart.
drawpath(){
let graphics = this.add.graphics();
let path = new Phaser.Curves.Path(0, 150);
for (let i = 0; i < 10; i++) {
// xRadius, yRadius, startAngle, endAngle, clockwise, rotation
if (i % 2 === 0)
path.ellipseTo(96, 62, 135, 45, true, 0); // 180 360
else
path.ellipseTo(96, 62, 225, 315, false, 0);
}
graphics.lineStyle(1, 0xffffff, 1);
path.draw(graphics);
//follower(path, x, y, texture [, frame])
for (let i = 0 ; i < 10 ; ++i) {
let follower = this.add.follower(path, 96, 150, 'rubberducky');
follower.setScale(0.5);
//startFollow( [config] [, startAt])
follower.startFollow(
{
duration: 10000,
positionOnPath: true,
repeat: -1,
startAt: i * .1
}
);
}
In the above code sample, they all start at the beginning at the same time. I Expected the startAt, would start them at a % along the path (so they would be evenly spaced from beginning to end).