Author Topic: Can't get moving platforms to work correctly  (Read 992 times)

solid.exe

  • Member
  • **
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Hi guys,

My new game uses moving platforms and I can't get them to wirk the way I want. They move exactly like I expected but when the player is riding it I get a problem: if the platform moves vertically, the player is bounced off the platform, floating for a little while and not being able to jump (as he is not touching the floor). This is of great importance to my game as it requires very precise timing in the platforming sections.

It is as if the platform was transferring its speed to the player. Is there a way to turn off this behaviour?

solid.exe

  • Member
  • **
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Can't get moving platforms to work correctly
« Reply #1 on: Fri, May 4, 2012 »
Just found where the velocity of the immovable object is transferred to the other object but I can't override the method (separateY) as it is static. Any tips?

auriplane

  • Snails!!
  • Contributor
  • ****
  • Posts: 497
  • Karma: +1/-0
  • Snails!!
    • View Profile
Re: Can't get moving platforms to work correctly
« Reply #2 on: Fri, May 4, 2012 »
You can call overlap() instead of collide() for the player and platforms, and write your own method to pass in, instead of FlxObject.separate.

The reason collide() has FlxObject.separate hard-coded is because that's the only thing it does.  If you don't want that, you want overlap(), which is more general.