Is there a tutorial that covers complete player movement for a 2D platformer?

Discussion in 'Off Topic' started by pixeltroid, Feb 24, 2019.

  1. pixeltroid

    pixeltroid Member

    Joined:
    Jul 23, 2016
    Posts:
    665
    this would be for a keyboard controlled game.

    Im looking for one that covers: walking, jumping, crouching and shooting sideways, upwards, diagonally while
    - walking
    - jumping
    - crouching.

    Im asking because my player movement code is all over the place and I am thinking of rewriting the whole thing using one source.

    If anybody has any recommendations, I'd like to hear it.
     
    Last edited: Feb 24, 2019
  2. Baukereg

    Baukereg Member

    Joined:
    Feb 22, 2019
    Posts:
    27
    I feel you, my platforming code always is a complete mess. I guess the topic is too complicated to have an ultimate best practise guide. You can make a briljant system that works flawless... and than you decide to add wall jumping and everything collapses.
     
  3. Bluetail7

    Bluetail7 Member

    Joined:
    Jun 20, 2016
    Posts:
    150
    I have a mess on my code.
    Without the proper comment in code and flagging each action with a specific name, I'd have been lost for weeks.
    It takes me a few hours to put everything together, and to remember which things can be combined with others.
    Using state machines could make the work easier, but it all depends on the way you code (there's this one asset on the marketplace subforum).
     
    Bearman_18 likes this.
  4. NeZvers

    NeZvers Member

    Joined:
    Mar 24, 2018
    Posts:
    320
    I simply break down movement system so it becomes more modular and I have nice integration for the state machine.
    get_input()
    horizontal_movement();
    ground_check();
    vertical_movement();
    horizontal_collision();
    vertical_collision();
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice