Path and Path Follower limitations in phaser

Hey guys,

I recently started using Phaser 3, I am creating a shooting game and here are few things I am stuck with.

I am creating a path using this tool and want to add some followers( A group of followers maybe) on this path.

First Problem: I want to use a image as a path because when I am using the line-style to create a curve there is some gap in path where 2 lines joins each other. FiddleLink

Second Problem: we can add followers in a chain using the delay but not using the position. I want to add first follower on the start on position(Which is working fine) and 2nd follower at the start position of first follower and so on.

Third Problem: How to dynamically update position of the followers on path? add and remove follower from chain and update positions of remaining followers.

I hope anybody can tell me if there is anyway how to do this in phaser, Thanks in advance.

  1. Try path.draw(graphics, 16).
  2. Adjust startAt I think.
  3. I think you can use follower.pathTween.seek(…).

Hi Samme,

Thank you so much for your answer.

Solution 1 looks good but I am not sure how to implement solution 2 and 3 as startAt gives the position of path not of the follower, If possible can you explain this a bit more…

I think I misunderstood (2) and (3). Can you explain?

checkout this game
I am trying to make something similar, add followers in a chain, when user shoots the incorrect ball, the shooting ball will be added to the follower chain and when he shoots the correct ball the follower will keep moving on the path and will form a chain.

fiddlelink

The current t position of a follower is in follower.pathTween.getValue().

You can call startFollow({ from: FROM, to: TO }) with any t values. With path.getLength() you can probably calculate a duration to give the same apparent speed on the path.

It’s a bit challenging to find the t for an (x, y) position on or near the path. You can calculate these in little areas on the path.

I found a way to do it using the path.getLength() and follower.pathTween.getValue().

Thanks for your help Samme