How do you create horizontal Wind physics using Platform Behavior?

  • Hello all,

    I'm working on a little platform game and I've come to a point where I need to have wind push the character to the right or left throughout stage. (Like Mega Man and Bass level with the rain and wind) I know this means using the X vector but it seems to be that the decel is getting in the way of the code functioning properly. For example if I write every tick set vector x to vector x + 30 or something it won't work because it's not strong enough to bypass decel. However, if I set decel to 0 then it will work. This isn't a good solution though because then the character is a bit too slippery.

    I can get it to work sort of by fudging with Max Speed and Decel and making custom Max Speeds depending if you are going left and right. But I don't think it works well enough.

    My other attempt just involved setting the player box's X position and always add to that but that has serious complications when it comes to slopes.

    Is there some way to apply a separate value from vector x to the platform behavior in order to apply wind effects without having to deal with decel and max speed?

    In Multimedia fusion there was a plugin called Platform Movement Object and it has 2 additional values called 'Additional X' and 'Additional Y' that is specifically for wind effects.

  • Hi, I think my solution is not the best but I think it could help you a bit.

    This is my screenshot :

    [

    ]

    And my c3p : drive.google.com/open

    Good luck!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi thank you for your help! When you replied you gave me an idea that hit me like a flash of lightning. My solution to this problem was to have another platform behavior and just use that as my secondary wind movement. As far as I can tell it works! The way I make it work is I just simulate a direction using second platform behavior that has a lower max speed than my main platform behavior. What's great about this method is I can just turn it on and off easily. No need for custom code.

    I need to remember for the future that behaviors can be combined and mixed and matched.

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