Events for PathFollower

In Dev Log 99 it’s described that you can use events/callbacks, e.g. onComplete, for PathFollowers.

Is there any documentation on how that works?

yes very cool example thanks for sharing, I dont understand what is not clear?
If u add a tween config to the follower object then add onComplete: function(){console.log(‘complete’)

Well I guess that’s the part I don’t understand: how do you add a tween config to a PathFollower?

PathFollower.startFollow() takes a PathConfig object as parameter:
https://photonstorm.github.io/phaser3-docs/Phaser.Types.GameObjects.PathFollower.html#.PathConfig
It has no onComplete property.

ok I am not an expert but it's obvious to me but I don't have time to test it but let us
say
    follower.start({etx etx.
    onComplete: (x,y)=> y})

Okay I tried it out but obviously I dont have a follower object so it doesnt work, also read a bit about the devlog maybe it is beta 4 material, and links and demos show errors on links so a bit disappointed

You can use onComplete in PathConfig.

The docs are incomplete in this area but I think PathConfig includes TweenBuilder config.

1 Like

Thank you, it does indeed work. The typescript definitions should be updated as well as the docs.

It’s a never-ending struggle. :grinning:

1 Like
1 Like

Looks good to me. :grinning:

   // follower.start({
            //     duration:3000,
            //     yoyo:true,
            //     repeat: 1,
            //     onComplete:()=>console.log('complete')
            // })

i tried this but i got error on follower.start is not a function I dont know what im doing wrong

The function is called startFollow.

1 Like