Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

About jumping

Discussion in '2D' started by Leweenie, Jan 23, 2015.

  1. Leweenie

    Leweenie

    Joined:
    Jan 21, 2015
    Posts:
    2
    **I am posting this here because the website won't let me post a question in the Questions/Answers section of the site for some reason.


    Does anybody know how I can implement #4 on this list:
    http://devmag.org.za/2011/01/18/11-tips-for-making-a-fun-platformer/

    Basically, I would like to allow the player to jump even if he has gone slightly off the edge. I think it might make the character feel more controllable. Does anyone know if this is possible/what is the best way to do it? I am writing my scripts in C#.
     
  2. vakabaka

    vakabaka

    Joined:
    Jul 21, 2014
    Posts:
    1,153
    there is not only one way to achive this.
    -You can place trigger, that allow you to jump in air (if physic is used)
    -canJump = Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround); make checkradius bigger
    -add boolean timer for some time to jump after the player is ungrounded
    -just make players collider little bigger
    ....
     
  3. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    760
  4. Leweenie

    Leweenie

    Joined:
    Jan 21, 2015
    Posts:
    2
    Thank yall for answering.
     
  5. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Allowing jumping when you're slightly off the edge just involves using a box collider for your character instead of a circle or similar. Depending on your "is grounded" check you can allow the player to jump when just 1 pixel of the box collider touches the platform, ie. the player is almost entirely standing in mid air. Most platformers do it this way I think. From your example this is how I feel it should be:



    The blue is the character's box collider and I painted in green in the same fashion as the author to show that he won't start falling until he moves 1 more pixel to the right.

    Doing it the way that the author of the article suggests sounds awful. And I don't think he realizes how long a second would feel in game. :p Being able to jump in mid air even if you just fell of a platform should be just the same as a normal double jump in my opinion.