How To Make 2D Ladders In Unity

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 เม.ย. 2021
  • Learn how to make 2D ladders in Unity!
    Source code: gist.github.com/bendux/30c245...
    SOCIAL
    Discord: / discord
    itch.io: bendux.itch.io/
    Twitter: / bendux_studios
    SUPPORT
    Buy Me a Coffee: www.buymeacoffee.com/bendux
    MUSIC
    Bossa Antigua by Kevin MacLeod
    Link: incompetech.filmmusic.io/song...
    License: filmmusic.io/standard-license
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 127

  • @PiratecodyPC
    @PiratecodyPC 3 ปีที่แล้ว +25

    I don't usually leave comments, but I really have to say, your Unity videos are some of the best I've seen. Keep it up!

  • @pandamaen5097
    @pandamaen5097 7 วันที่ผ่านมา

    i love the description of the player sprite

  • @tamasorvos8882
    @tamasorvos8882 2 ปีที่แล้ว +2

    Straight to the point, easy to follow. Thank you!

  • @pianoatthirty
    @pianoatthirty ปีที่แล้ว +2

    The way you present this information is really outstanding. Make a Udemy or some kind of 2D platformer course - I'm sure I'm not the only person who would happily buy it. This kind of to-the-point teaching is pretty rare in game tutorials.

  • @NukyGummyBear
    @NukyGummyBear ปีที่แล้ว

    great tutorial, just what i was looking for after trying several complicated methods to no avail. keep up the great work!

  • @hellblazer8543
    @hellblazer8543 2 ปีที่แล้ว +1

    this is so straight to the point. thank you for this :)
    i hope you discuss something like grappling hooks

  • @julianspring3844
    @julianspring3844 ปีที่แล้ว

    had a problem with a wall climbing mechanic using raycasts, you vid helped a ton. thanks dude!

  • @jayowe4365
    @jayowe4365 3 ปีที่แล้ว +1

    you nailed it. i was looking for this code. the other ladder codes on youtube didnt work as well as this one.

  • @btud8645
    @btud8645 2 หลายเดือนก่อน +1

    was working with GPT for about 40 minutes and kept breaking it. Watch your video and in 4 minutes I have it done. Thanks so much homeslice

  • @NathanOnline
    @NathanOnline 2 ปีที่แล้ว +1

    Awesome tutorial! Was really simple to follow and worked amazingly!

  • @Chocoholic395
    @Chocoholic395 2 ปีที่แล้ว +9

    Thanks for the video, works good, the only problem I encountered was falling through the ladder while jumping on it from above.
    For that I changed > to >= in the 19 string, so you could stick to the ladder immediately when jumping on it.

    • @bendux
      @bendux  2 ปีที่แล้ว +2

      Thank you for sharing!

    • @markv6684
      @markv6684 ปีที่แล้ว

      thx, that help me :3

  • @mariafrancesfontes8377
    @mariafrancesfontes8377 2 ปีที่แล้ว

    you just saved my project, thank you very much

  • @elostolol0197
    @elostolol0197 2 ปีที่แล้ว +1

    dude, you should make more videos tutorial. Your explanations is amazing

  • @ozkanaltiok551
    @ozkanaltiok551 3 ปีที่แล้ว

    perfect video mate well done

  • @user-mh1jl1bu4s
    @user-mh1jl1bu4s ปีที่แล้ว

    это реально классные видео уроки по той причине что они работают я часто сталкивался с проблемой что ни один код или способ их применения не работал , однако все способы этих видеоуроков работают безотказно

  • @1Fated
    @1Fated 2 ปีที่แล้ว

    This is gold. Thank you

  • @justusisbestest4122
    @justusisbestest4122 2 ปีที่แล้ว

    very good tutorial, thanks!

  • @tacticalmythic7945
    @tacticalmythic7945 2 ปีที่แล้ว

    thanks. Really needed this for my platformer game XD. SUBBED

  • @stormy2049
    @stormy2049 ปีที่แล้ว

    It works!! Thank you very much!!

  • @BluccOfficial
    @BluccOfficial 2 ปีที่แล้ว

    Ich hab ein 2D Jump and Run Game und wollte fragen wie das funktioniert mit dem speichern. z.B. wenn ich in einem neuen Level(Szene) bin, dass ich dann speichern kann und sobald ich das Spiel öffne, dass ich dann z.B. in Szene 2 bin, wo ich gespeichert hab.
    Und gutes Tutorial :D

  • @alexandretome2087
    @alexandretome2087 9 หลายเดือนก่อน

    Good job man!

  • @ryankutukwa7009
    @ryankutukwa7009 3 หลายเดือนก่อน

    I know this video is a bit old but is there a way to do the script in the unity script graph

  • @baymgram9754
    @baymgram9754 ปีที่แล้ว

    thanks for the code bro!

  • @danlaji
    @danlaji ปีที่แล้ว

    i love your videos so much keep going

  • @icywenier1469
    @icywenier1469 2 ปีที่แล้ว

    Man, you're a beast!

  • @Mysticscubing
    @Mysticscubing 2 ปีที่แล้ว +1

    Thank you it worked

  • @johnwells558
    @johnwells558 ปีที่แล้ว

    What needs to be done to stop direction while jumping. Great vids

    • @bendux
      @bendux  ปีที่แล้ว

      Join our Discord server, and let's solve your problem together!

  • @PRABHUJA
    @PRABHUJA 11 หลายเดือนก่อน

    how i play my climb animation Please Help

  • @gececiyim87
    @gececiyim87 ปีที่แล้ว

    Thank u so much man!

  •  2 ปีที่แล้ว

    "Boom! Ladder" Boom ! subscribed

  • @RandomDude00001
    @RandomDude00001 ปีที่แล้ว

    Hi! im new to unity C# programming Im learning alot from your videos I watch your jump boost video a its very awesome but can you also make a speed boost pad?

  • @Kopellis
    @Kopellis 4 หลายเดือนก่อน +1

    i did it with ontriggerstay and it didnt work. Let me try like that.
    Yeah just tried it and it works. i dont understand why on triggerstay doesnt work

  • @neenaw
    @neenaw 3 ปีที่แล้ว +1

    That character really is a bellend 🔔
    This was a good break down. Ladders coming soon to Dino Dungeon.
    Also I never realised that BroForce doesn't have climbing ladder animations, I wish I could get away with that.

  • @Meithighs
    @Meithighs 3 ปีที่แล้ว

    Took me a while to fix mine.. I had a character that used a square hitbox but the character wasnt square so he was refusing to climb the ladder and I never figured out why.. so i just made the character out of a piece of floor and... it works. thanks lol

  • @patriciajin6206
    @patriciajin6206 ปีที่แล้ว

    You're a good man

  •  2 ปีที่แล้ว

    that was awesomeee

  • @cgillis3989
    @cgillis3989 ปีที่แล้ว

    I saw you had box colliders on your ladders, but all those did for me is make me unable to touch the ladders. So I removed them but now I can't climb the ladders. I'm certain my code is fine so am I just missing something?

    • @bendux
      @bendux  ปีที่แล้ว

      Add a Box Collider 2D component to it and make it a trigger.

  • @darealspawn
    @darealspawn 2 ปีที่แล้ว

    how to avoid that jump look when player has reached the top of the ladder. It would be better if the climbing movement stops at the top somehow.

    • @bendux
      @bendux  2 ปีที่แล้ว

      You could create an invisible one-way platform above the ladder.

  • @q432gaming9
    @q432gaming9 3 ปีที่แล้ว

    u saved me thanks a lot.

  • @botolaqua9003
    @botolaqua9003 11 หลายเดือนก่อน

    idk what i'm doing wrong but my script doesn't work while it's the exact same as the video the 'rb' after finishing the script not showing and unity said there's an error

    • @bendux
      @bendux  11 หลายเดือนก่อน

      What kind of error message do you get?

  • @islamali5214
    @islamali5214 2 ปีที่แล้ว

    Keep it up

  • @doodlebugdev6990
    @doodlebugdev6990 ปีที่แล้ว +1

    Now I wasnt gonna say it so im glad you did 0:45

  • @badepallyajay9574
    @badepallyajay9574 ปีที่แล้ว

    Thankyou soooo much.

  • @MikaelL
    @MikaelL ปีที่แล้ว

    Thank you

  • @heroysake
    @heroysake ปีที่แล้ว

    Just a quick question, how do you get code proposals when you write ? Do you use a particular "intellisense" extension ?

    • @bendux
      @bendux  ปีที่แล้ว +1

      learn.microsoft.com/en-us/visualstudio/gamedev/unity/get-started/getting-started-with-visual-studio-tools-for-unity

    • @heroysake
      @heroysake ปีที่แล้ว

      @@bendux Thank you very much, it works !

  • @Mordexito
    @Mordexito ปีที่แล้ว

    Thanks ❤❤

  • @idinaxyiadmin
    @idinaxyiadmin ปีที่แล้ว +1

    Спасибо, всё отлично работает!

  • @jayowe4365
    @jayowe4365 3 ปีที่แล้ว

    i like your script, but im trying to find out how to prevent the character from jumping on the top of the ladder. so he'll just stop on a dime? how is that done?

    • @bendux
      @bendux  3 ปีที่แล้ว +1

      You could create an invisible one-way platform above the ladder.

    • @jayowe4365
      @jayowe4365 3 ปีที่แล้ว

      @@bendux ill try it and let you know how it works. thats not a bad idea

  • @ryanbaltes8874
    @ryanbaltes8874 2 ปีที่แล้ว

    I get an error that says Inout Axis vertical is not setup

    • @bendux
      @bendux  2 ปีที่แล้ว

      Would you like to show me your code on Discord?

  • @F8__Player
    @F8__Player 3 ปีที่แล้ว

    thank you

  • @annalis8729
    @annalis8729 3 ปีที่แล้ว

    Hello!!
    It goes up perfectly but then when I pass through the ladder it falls down...

    • @bendux
      @bendux  3 ปีที่แล้ว +1

      You could create a one-way platform to prevent the player from falling down the ladder.

  • @johndee2091
    @johndee2091 2 ปีที่แล้ว

    I did follow the tutorial I have put a vertical input in game setting and it seem like i can't climb the ladder but no error in the console :/ any clue ?

    • @johndee2091
      @johndee2091 2 ปีที่แล้ว

      EDIT: Nevermind I am dump forgot istrigger on boxcollider

    • @bendux
      @bendux  2 ปีที่แล้ว

      @@johndee2091 I'm glad you were able to fix it.

    • @ClashingWithWESLEY
      @ClashingWithWESLEY 2 ปีที่แล้ว

      @@johndee2091 i have the same issue? is it to do with the player or ladder?

  • @ahmetomercicek5848
    @ahmetomercicek5848 ปีที่แล้ว

    Does this method also work in 3D? maybe with a few changes

    • @bendux
      @bendux  ปีที่แล้ว

      Unfortunately, I haven't tried it yet, but it should also work in 3D.

  • @Lili-mq5ef
    @Lili-mq5ef ปีที่แล้ว

    Where can i find the ladder?

    • @bendux
      @bendux  ปีที่แล้ว

      What do you mean?

  • @random_precision_software
    @random_precision_software 2 ปีที่แล้ว

    How do uou get down tho? the box collider for the platformsa is stopping it.

    • @bendux
      @bendux  2 ปีที่แล้ว

      You could turn the platform into a one-way platform.

    • @random_precision_software
      @random_precision_software 2 ปีที่แล้ว

      @@bendux tried that, doesn't work.

    • @bendux
      @bendux  2 ปีที่แล้ว

      @@random_precision_software Would you like to show me your code on Discord?

  • @Pixel_J
    @Pixel_J ปีที่แล้ว

    Who wants to see the ladders professor go higheeer!

  • @dondamaso2337
    @dondamaso2337 2 ปีที่แล้ว +1

    It worked perfect! but for some reason it interferes with my player's ability to jump... I still haven't figured out why.

    • @bendux
      @bendux  2 ปีที่แล้ว

      We have a solution for that on our Discord server. Feel free to join!

  •  2 ปีที่แล้ว

    btw what is the game you are playing in intro and outro

    • @bendux
      @bendux  2 ปีที่แล้ว

      The game is called Broforce.

    •  2 ปีที่แล้ว

      @@bendux thanks

  • @Limedigs
    @Limedigs 2 ปีที่แล้ว

    I put it in it isn't working for me, can you send me the script in comments so I can copy and paste it?

    • @bendux
      @bendux  2 ปีที่แล้ว

      I've added a link to the source code to the description.

  • @James-dy6wi
    @James-dy6wi ปีที่แล้ว

    Awesome video! Could you create a video using the new unity Input System?

    • @bendux
      @bendux  ปีที่แล้ว +1

      We have a solution for that on our Discord server. Feel free to join!

  • @paulasierraluque1447
    @paulasierraluque1447 ปีที่แล้ว

    hi i was wondering how to exit the ladder without an impulse...

    • @bendux
      @bendux  ปีที่แล้ว

      What do you mean?

  • @olsz12
    @olsz12 2 ปีที่แล้ว

    How to jump while you on ladder ??

    • @bendux
      @bendux  2 ปีที่แล้ว

      The answer to your question goes beyond the scope of a TH-cam comment, but I'd still like to help you. Join our Discord server, and let's solve your problem together!

  • @wandersonrodrigues123
    @wandersonrodrigues123 2 ปีที่แล้ว

    What is the name of the game that appears at the beginning?

  • @wew1.076
    @wew1.076 2 ปีที่แล้ว

    It docent work for me beacuse of SerializeField do you know why?

    • @wew1.076
      @wew1.076 2 ปีที่แล้ว

      Oo i made it work btw your videos are so ez to follow :))

    • @wew1.076
      @wew1.076 2 ปีที่แล้ว

      My ladder dident work :( it might have to do with mu charecter tho..

    • @wew1.076
      @wew1.076 2 ปีที่แล้ว

      My*

    • @bendux
      @bendux  2 ปีที่แล้ว

      Would you like to show me your code on Discord?

  • @TransGuyShane
    @TransGuyShane 3 ปีที่แล้ว +1

    That wall slide was pretty cool , do you have a tutorial for that? ♡

    • @bendux
      @bendux  3 ปีที่แล้ว

      Do you mean the wall slide from Broforce?

    • @TransGuyShane
      @TransGuyShane 3 ปีที่แล้ว

      @@bendux is that the name of the game at the start and end? If so yes ♡

    • @TransGuyShane
      @TransGuyShane 3 ปีที่แล้ว

      The character does a little wall slide climb thing at 4:08

    • @bendux
      @bendux  3 ปีที่แล้ว +1

      @@TransGuyShane Unfortunately, I don't have a tutorial, but I can try to make one in the future.

    • @TransGuyShane
      @TransGuyShane 3 ปีที่แล้ว

      @@bendux that would be awesome.
      No need to push yourself but it would be nice to see one :)

  • @jameslord9708
    @jameslord9708 4 หลายเดือนก่อน

    i dont know why but i cant go up even when im in range

    • @bendux
      @bendux  4 หลายเดือนก่อน

      It's hard to tell what's going on without seeing your script.

  • @chewchu4580
    @chewchu4580 3 ปีที่แล้ว

    can you make an enemy attack video

    • @bendux
      @bendux  3 ปีที่แล้ว +1

      I've never created enemies in Unity before, but I can definitely give it a try.

  • @togglebott7748
    @togglebott7748 2 ปีที่แล้ว

    this video was great and super informative and concise, but if you'd allow some criticism, that smear/motion blur filter thing actually hurts my eyes a bit lol

    • @bendux
      @bendux  2 ปีที่แล้ว

      It probably has something to do with my video editing software. I'm sorry!

  • @gracetang1025
    @gracetang1025 2 ปีที่แล้ว

    Can you add climbing animation while on the ladder? I tried to do this on my own and facing an issue. When the player stop on the ladder. The animation still on.

    • @bendux
      @bendux  2 ปีที่แล้ว

      Would you like to show me your code on Discord?

  • @devmarboy4045
    @devmarboy4045 ปีที่แล้ว +1

    0:44 😭😭💀

  • @0yousif0
    @0yousif0 2 ปีที่แล้ว

    Nice player explation lol

  • @woodenfences
    @woodenfences 3 ปีที่แล้ว

    Hehe, Denis

  • @TheSyberglitch
    @TheSyberglitch ปีที่แล้ว +2

    The idea is good, but it lacks so many things to be usable. For instance, this script only works when player climbs up it does not work if player wants to go down on ladder. Than it works only if behind the ladder there is no collidable tile layer like ground or such which kind of make ladder float on nothing.

  • @davidbielsa5188
    @davidbielsa5188 ปีที่แล้ว

    You pronounce "player" pretty much like brackeys. Are you from Sweden too?

    • @bendux
      @bendux  ปีที่แล้ว

      Haha, I'm actually from Germany.

  • @dreadge
    @dreadge 2 ปีที่แล้ว

    this script keeps crashing my unity

    • @bendux
      @bendux  2 ปีที่แล้ว

      Would you like to show me your code on Discord?

    • @dreadge
      @dreadge 2 ปีที่แล้ว

      @@bendux i just pre applied the code then wrote it and it worked, unity is strange ( i copy pasted btw

    • @bendux
      @bendux  2 ปีที่แล้ว

      @@dreadge I'm glad you were able to fix it.

  • @rubabmubarrat
    @rubabmubarrat 2 ปีที่แล้ว

    This is not ladder movement, It’s just a levitation of player object. The climbing is not natural at all

  • @aqri3603
    @aqri3603 ปีที่แล้ว

    1k

  • @phonglam1134
    @phonglam1134 ปีที่แล้ว +1

    bad totural

  • @TheNono72n
    @TheNono72n ปีที่แล้ว

    i changed the code a bit to suit my game
    using Platformer.Mechanics;
    using UnityEngine;
    public class LadderMovement : MonoBehaviour
    {
    private float vertical, newGravityScale;
    private float speed = 8f;
    private bool isLadder;
    private bool isClimbing;
    [SerializeField] private Rigidbody2D rb;
    void Update()
    {
    vertical = Input.GetAxisRaw("Vertical");
    if (isLadder && Mathf.Abs(vertical) > 0f)
    {
    isClimbing = true;
    }
    }
    private void FixedUpdate()
    {
    if (isClimbing)
    {
    rb.gameObject.GetComponent().enabled = false;
    newGravityScale = rb.gravityScale;
    // rb.gravityScale = 0f;
    rb.bodyType = RigidbodyType2D.Dynamic;
    rb.constraints = RigidbodyConstraints2D.FreezePositionX;
    rb.velocity = new Vector2(rb.velocity.x, vertical * speed);
    }
    else
    {


    rb.constraints = RigidbodyConstraints2D.None;
    rb.gameObject.GetComponent().enabled = true;
    // rb.gravityScale = newGravityScale;
    }
    }
    private void OnTriggerEnter2D(Collider2D collision)
    {
    if (collision.CompareTag("Ladder"))
    {
    isLadder = true;
    }
    }
    private void OnTriggerExit2D(Collider2D collision)
    {
    if (collision.CompareTag("Ladder"))
    {
    if (rb.gameObject.GetComponent().isActiveAndEnabled==false)
    {
    rb.bodyType = RigidbodyType2D.Static;
    }
    isLadder = false;
    isClimbing = false;
    }
    }
    }