Moving player on a PathFollower platform

Hello everyone :slight_smile:
I am developing my first Phaser platformer and would like to ask a few questions.
There are many platforms in my game and they are moving in different ways. It seems to me that making them PathFollowers is quite reasonable, it is very easy to make them move along complicated curves. But I want the player sprite to move with platform when it stands on it. It was no problem when I tried to make platform movement by setting velocity. I see the only solution is to set player sprite x and y according to moving platform position, but it turns out to be kinda weird. Would appreciate any help.

1 Like

up

Still stuck and hoping to get some advice.

Could it be because PathFollowers are not physics GameObjects?

Welcome Caminante, what is weird about setting the player’s x and y to the platforms? Would you be able to supply any sample code on what you have done so far?

You could make a simple codepen.io or go to Phaser Lab’s editor to set up a simple example and paste the code here.

@Rasmus-M no, PathFollowers extend Sprite and can have physical body. The problem is that they do not have velocity while moving along path.

@Jake.Caron thanks! Well, I tried to change player’s coordinates in the game update loop, and it was working, but player was still getting behind the platform with time. Now I moved the coordinates update into the Path tween onUpdate callback, and it seems to work quite smoothly. I still have no idea why it is so much better than placing it in game update loop, but it works.

@Caminante Are you able to share how you’ve attached the player to the platform? Are they able to move around freely while still being on it?