Stop player sliding on moving platform?

hello I have a moving platform left to right. when the player is on the moving platform and the platform changes direction the player slides out of position?

example maybe hard to see player keeps moving position when platform changes direction
example

2 Likes

It’s because the character behavior follows the platform with 1 frame delay.

It could be fixed by moving the code that do the following from doStepPreEvent to doStepPostEvent.

I’m not sure if there is an easy workaround.

1 Like

This issue should be fixed in future releases of GDevelop. Thank you for reporting it.

4 Likes

Hi. I’ve solved that problem using events.
Please, take a look at the image attached.
In my code:

  • RobotLower is the player
  • MovPlat1 is a horizontal moving platform
  • MovPlat3 is a circular moving platform

I still havent found a way to fix another glitch, with vertical moving platforms, in which there’s a one pixel gap between the Player’s feet and the platform when it’s going down. The work around I found for that was simply adjusting the speed of the platform. If it isn’t too slow or too fast, the glitch doesn’t appear.

Hope it helps!

hi I recently tested the player sliding on moving platform with gdevelop version 5.1.159 and updated the rectangle movement extension but the issue is still happening.

1 Like

Yes, the PR is still not merged into GDevelop. The submitted solution works but it’s not clear if this is the right way to do it.

2 Likes

I’ve made some little adjustments to my code. I’m gonna post the updated version here soon.
I’ve tested it on different PCs and cell phones, and the sliding issue never appeared again. And apparently, it didn’t “create” new issues. I’m not sure if it’s the most optimezed way to solve the problem, but I’ll be using this workaround for now. But it will be great if this problem is solved in future updates of the engine.
I’ve made a testing build of my game. Is it OK if I post the link for it here so you can see how the code works?
I’m asking because I’m new here, and I don’t know if there are any rules about posting links for the games we make. :sweat_smile:

Since it’s related, why not. Although it will be a lot faster if you record a gif and post screenshots of the events aswell : D

1 Like


15.04.2023_21.45.47_REC

Hi everyone.
I’m posting a new screenshot of the code (I’ve updated a few things) and a gif image showing what happens when the player stands on the moving platform. It no longer slides one pixel when the platform changes its direction.
I’m not sure if it’s the most optimized way to use events to fix it, but that’s what I’ve got for now.
Hope it may be helpful.

2 Likes