0 Favourites

How do I make a Platformer "pushed back" upon collision ?

  • Say I have a Platformer running towards an object, upon collision, I want the platformer to be "pushed back" as though the enemy called him to "back off".

    Setting the Vector X seems to not do the trick...not even when I set it to 10000000000000000.

    How do I make the object bounded back horizontally ?

  • This is what I have so far, it is not working

    I typed in lots of zeros in my frustration that the platformer is not even moving horizontally away at all.

  • If your player is moving right when it collides then perhaps you need a negative vector x value? Failing that, my technique would be to give it LiteTween behavior and just temporarily disable platform behavior while he moves backwards using a tween effect. When the tween finishes, then enable platform behavior again...

  • Thank you Colludium, I hint your advise and used LiteTween, it works PERFECTLY.

    Wow, that VectorX thingy is USELESS.

    The Vector Y works though, but Vector X is Utterly USELESS with or without ignoring user input.

    I will never touch Vector X for Platformer again.

    I tried to work within the Platform's position placement feature because I don't want an external behavior that is not part of the Platform to affect positional movement to avoid glitches, seems like the internal Platform's vector X is a let down.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Seems like you have to increase the max speed a lot to make Vector X work and give a proper "push".

    And I'll throw in this example I found somewhere on this board:

    on collision with enemy

    set vectorX: (self.X-enemy.x)/Abs(self.X-enemy.X)*1000000

    this works from both left and right of the enemy and "pushes" you back in the opposite direction.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)