Deacceleration of player when switching controls?

  • I have a player that switches between platform controls and 8direction input if it encounters a ladder. Although if it encounters a ladder while pressing left or right it will just pass it by unless it presses up or down to climb. My problem is that if left (or right) is pressed down (and not released), it passes a ladder by, but also slows down (specifically the vector x drops). So every time the player encounters a ladder, it slows down at the same time the controls are switching from platform to 8direction input. I have made sure the platform values (e.g. acceleration, deceleration, and max speed) match the 8direction values but it doesn't make a difference. I tried setting the 8direction vector x value to the platform vector x value but that creates a new problem with the player moving slowing through the ladder if it started slow. Any ideas? This is my first forum post Thanks in advance!

  • Maybe you ought to start off with 8direction disabled. Then go:

    If player is overlapping ladder & Player is pressing UP or DOWN

    --Activate 8direction

    Else

    --Deactivate 8direction

    If you are still stuck, it always helps to post a capx.

    Welcome to the forum.

  • Thank you for helping, however, I already have my "code" setup like that. Here is the capx though: https://www.dropbox.com/s/3mzn7rwzthbup ... .capx?dl=0

  • SarcasticNash

    EDIT: Nevermind...got dropbox to work.

    Dropbox is acting up on me today...could you post the capx as a forum attachment?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I built a new example with your assets. This version uses tilemaps. The code is a lot simpler; only 5 events.

  • Thank you TiAm! It is so simple and beautiful, it is a work of art! I have a lot to learn. Guess I also need to spend more time learning about tilemaps too. Are there any good tutorials that deal with tilemaps and random generation?

    EDIT: Now that I am looking around a little more I've found some great tutorials/examples, I guess I just based my ladder stuff on bad ladder examples. Thanks again.

  • Glad I could help...good luck with your project.

  • I've integrated the code into my game and have noticed some problems such as my player falling slowly through the ladder even though gravity is at zero. When I go back to the capx you provided I have found some of the same problems, especially if you delete the tiles above the character to give a bit more room. You can get the character to fall through the ladder if you test it going up and down. Any idea why this is might be occurring?

  • Whoops <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    I forgot to clear the Y vector of movement when the player overlaps the ladder. Otherwise the player is stuck in a perpetual 'jump' or 'fall'. Here's an updated capx:

    https://www.dropbox.com/s/qfaa1ghcm6h9z ... .capx?dl=0

  • Solved all my problems. Thanks again!

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