HOW TO MAKE 2D LADDERS IN UNITY - EASY TUTORIAL

Поділитися
Вставка
  • Опубліковано 25 лис 2024
  • In this Unity and C# tutorial we will make a simple ladder system !
    By the end of the video your player character will be able to climb a ladder (or any other object you may want him to climb for that matter) !
    --------------------------------------------------------------------------------------------------
    SUPPORT ME : / blackthornprod
    ------------------------------------------------------------------------------------------------
    LINK to the ONE WAY COLLISION PLATFORM : • ONE WAY COLLISION PLAT...
    LINK to the 2D PLATFORMER CONTROLLER : • 2D DOUBLE / TRIPLE JUM...
    --------------------------------------------------------------------------------------------------
    LINK to my TWITTER : / noacalice
    LINK to the DISCORD SERVER : / discord

КОМЕНТАРІ • 141

  • @TheMackizar
    @TheMackizar 5 років тому +4

    I was struggling with ladders, but this video is short and informative enough for me to follow along. I am now excited to go home and implement!

  • @francis10583
    @francis10583 4 роки тому

    thank you, im an artist and definitely not a programmer , your videos helped me a lot to build a very simple game-- well, actually not a game, but an avenue where i can showcase and test my animations and created character game assets. Thank you again!

  • @beri4138
    @beri4138 4 роки тому +1

    Guys if your ladder is a tilemap DON'T USE COMPOSITE COLLIDER. The raycast will NOT work for a composite collider. I learned it the hard way it took me HOURS.

  • @AlexanderZotov
    @AlexanderZotov 6 років тому +17

    Good one!

  • @pranavpanchal7648
    @pranavpanchal7648 6 років тому +2

    I started watching your videos when brackys testing your game

  • @slynizz1014
    @slynizz1014 6 років тому +4

    I really did need this. Thank you Noa

  • @GameDevAnd3D
    @GameDevAnd3D 6 років тому +7

    awesome...can u make a video of how to do wall jumps and slope detection?(and player takes the appropriate angle)

  • @madin1771
    @madin1771 5 років тому +7

    can you help me ? that script is not work for me , i must press up arrow over and over after my character pass the ladder collider (the character climb when his collider over the ladder)and can climb but the gravity never set back to 0, so i must back to the ladder collider to get the gravity again, help

  • @lvlGhostlylvl
    @lvlGhostlylvl 4 роки тому +2

    If its not working for anyone make sure you type GetKey. Not GetKeyDown

  • @henryjohn6244
    @henryjohn6244 5 років тому +3

    This video is very helpful, but can you add more animation please!

  • @tejaschalke1778
    @tejaschalke1778 6 років тому +3

    Please make a video on climbing slopes... Please.

  • @Wadricks
    @Wadricks 6 років тому +3

    Great Video, love the enthusiasm. Is there any resources you can point us to, to help with jumping off the ladder while gravity is still set to 0, I am having a hard time figuring this one out.

  • @toniconge7003
    @toniconge7003 4 роки тому

    Nice! I had no idea about the one way collider :O
    Now to figure out going down the ladder.

    • @ozmega
      @ozmega 4 роки тому

      for some reason mine just got the down arrow to climb down, i didnt do anything different, but i also cant get out of them with the horizontal movement

    • @ihavecreatism9776
      @ihavecreatism9776 4 роки тому +1

      @@ozmega That's because Input.GetAxis("Vertical") gets both up and down input in a range from -1 to +1.
      If you press down, you have inputVertical(now -1)*speed.
      If this helped you understand the reason better, please consider subscribing to my channel.

  • @dontforgetthegame
    @dontforgetthegame 3 роки тому

    Thanks great tutorial, covers so much ground :)

  • @ChooseKindness9999
    @ChooseKindness9999 5 років тому +3

    DO MULTIPLAYER OR ELSE! (Satire, you are unity hero!)

  • @SBroproductions
    @SBroproductions 6 років тому +29

    Do you have a name for the little square guy? He's cute.
    How about "Blox"?

  • @plutosartist8394
    @plutosartist8394 5 років тому +12

    can you do a tutorial where if you already had a player controller, and you just want to climb the ladder?

    • @redwane2431
      @redwane2431 4 роки тому +3

      did you find a way to do that?

    • @age9502
      @age9502 4 роки тому

      Yes?

    • @beri4138
      @beri4138 4 роки тому +1

      You literally just add this code to your script wtf man

  • @michelangelobaroni938
    @michelangelobaroni938 4 роки тому

    love you, you've been so helpful. It works just fine :)

  • @jeppy4021
    @jeppy4021 5 років тому +16

    What if I want to come down after climbing the ladder fully?

    • @cjeeckazad2995
      @cjeeckazad2995 4 роки тому +1

      Jepson Art and more Stuff I guess you should watch this video -> ua-cam.com/video/M_kg7yjuhNg/v-deo.html

    • @Johncowk
      @Johncowk 3 роки тому

      Input.GetAxis("vertical") will return 1 if you press up and -1 if you press down, so this already implemented in this video's code.

  • @beaverjoe9171
    @beaverjoe9171 6 років тому

    Wow how fast you update your tutorial! I like that all of them. Can you make one tutorial one player can Sprint when he was jumping. I saw you many vedio using that parts. Anyway, Each tutorial I followed by my laptop and I really enjoy your vedio! Thanks so much !

  • @tejaschalke1778
    @tejaschalke1778 6 років тому

    Helped me was in need for something like this !!

  • @maximonova4235
    @maximonova4235 5 років тому

    Excellent job YOU ROCK!!

  • @thomasjensen9581
    @thomasjensen9581 6 років тому +1

    this is so awesome!

  • @williamstrnad4243
    @williamstrnad4243 6 років тому +3

    Hey Noa can you make a tutorial on a block placing system in unity 2d

  • @gameenginedeveloper4777
    @gameenginedeveloper4777 6 років тому +1

    Your videos are so great. Keep going like that.
    MAKE IT EASY!
    Game development must be as funny as gameplays!! ^_^

    • @Blackthornprod
      @Blackthornprod  6 років тому

      Thanks :) ! Yep game making can is as great as playing games, and even more rewarding !

    • @gameenginedeveloper4777
      @gameenginedeveloper4777 6 років тому

      I am starting on game developing and trying to learn 2D basics. The way you teach is so great and that's why I said that. Keep going and I hope you can make an inventory system any time on the channel. It will help me so much :D
      Your welcome and cya :')

  • @Ryaboy124
    @Ryaboy124 5 років тому +1

    Thx man

  • @zadiiten
    @zadiiten 5 років тому +5

    Hey man! great tutorials. i just have a question and i cant seem to make it work. once i reach the ladder and press the up key, my character just flies away. i have no idea what is going on. any idea what im doing wrong? cheers

    • @sarahcruz2103
      @sarahcruz2103 5 років тому

      did you figure it out? same issue with me

    • @snowytimothy9559
      @snowytimothy9559 5 років тому

      You assigned the jump button to the Up arrow key, making it jump when the function changes to zero gravity.

    • @teaMmMate
      @teaMmMate 2 роки тому +1

      Check the red note at 5:26

  • @marcodiazordonez115
    @marcodiazordonez115 3 роки тому

    Thanks bro, can You to make videotutorial on Ledge climb.

  • @DawnosaurDev
    @DawnosaurDev 6 років тому +17

    Could you make a video on adding Multiplayer to this please???
    Please like if you agree.

  • @muhammadtaqawi1999
    @muhammadtaqawi1999 5 років тому

    nice work

  • @patrickveit5313
    @patrickveit5313 3 роки тому +1

    i have to clik a lot of times on the up arrow so it can work.
    any idea why?

  • @FR35H_tv
    @FR35H_tv 6 років тому

    THANK YOU SO MUCH AGH

  • @IAMMAT87
    @IAMMAT87 5 років тому +1

    Great video, how about ladder jumping mate

    • @beri4138
      @beri4138 4 роки тому

      Just enable jumping while on ladder?
      Something like:
      If (isClimbingLadder)
      canJump = true;
      If (canJump && Input.GetKey("Jump"))
      Jump();

  • @bhimyaantv
    @bhimyaantv 4 роки тому

    please make tutorial on how to making character climbing and swinging on rope system in unity 3d

  • @zaart1334
    @zaart1334 6 років тому

    Nice one :)

  • @ardenbelfry
    @ardenbelfry 6 років тому

    could you do wall jumping and climbing?

  • @random_precision_software
    @random_precision_software 2 роки тому

    Yea, but every tutorial shows platforms away from the ladder,I want the platforms right up to the ladder so you can walk across and have 2 way walking up and down later without top platform collider in the way.

  • @FinnTG
    @FinnTG 6 років тому

    i think you should add "2D" after LADDERS in the title ;)

    • @Blackthornprod
      @Blackthornprod  6 років тому

      True enough :) ! I'll add that straight away !

  • @sakman9534
    @sakman9534 5 років тому

    can u plz make a video for 1st person shooter climbing ladder

  • @wignermatos1470
    @wignermatos1470 6 років тому

    Thanks

  • @0oh_no
    @0oh_no 5 років тому

    Please make a tutorial on making a Snake game movement? Plaease

  • @TopzicGaming
    @TopzicGaming 3 роки тому

    What mining game was that at the beginning of the video?

  • @nutsquirrel84
    @nutsquirrel84 6 років тому +1

    gimme more 2d aww yisss 😂😂 i am trying to make a game like "duck game"

  • @yaaaaaaaah
    @yaaaaaaaah 2 роки тому

    Great video, but the {} formating gave me a headache

  • @gohelboy
    @gohelboy 5 років тому +1

    How can i apply this using UI buttons ???

    • @beri4138
      @beri4138 4 роки тому

      Have a function that the UI button calls when pressed. In that function set a bool. Use the bool instead of GetAxis.

  • @Aboqamel
    @Aboqamel 6 років тому +1

    all works well , but i have to press Uparrow many times to climb , when it's supposed to hold the Uparrow key to climb , what am i doing wrong ?
    ive checked the gravityScale , once i press Uparrow it becomes 0 and goes back to 5 very quickly i barely notice it changes

    • @taij.9961
      @taij.9961 6 років тому +1

      This happened to me as well but I fixed it. I forgot to add the following section:
      if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.RightArrow))
      {
      isClimbing = false;
      }
      }
      check if this section is as its supposed to be. Hope this helps!

    • @itsmoonlight9649
      @itsmoonlight9649 4 роки тому

      @@taij.9961 where do i put it

    • @beri4138
      @beri4138 4 роки тому

      Use GetKey instead of GetKeyDown.
      Tai's comment has nothing to do with anything.

    • @Aboqamel
      @Aboqamel 4 роки тому

      @@beri4138 I stopped working on that project and started a new one 😂, thanks for replying 🙏😊

  • @danielbrophy5752
    @danielbrophy5752 6 років тому

    Hi how would you add an animation?? Could you do a video please??

  • @toastedbred2961
    @toastedbred2961 4 роки тому

    Its working, but I can only climb ladders when Im on the ground, and not in the air. Why?

  • @diving_mooti5092
    @diving_mooti5092 6 років тому +1

    Hey, can you please try replying asap? (also awesome quality videos

    • @Blackthornprod
      @Blackthornprod  6 років тому

      Hey :) ! Nop I've not actually made yet a tutorial on animation transitions (with Unity's Animator Controller)! But making such a video is definitely on my to do list :) !

    • @henryh7140
      @henryh7140 6 років тому

      Just call Animator.SetBool() for a boolean that is true if your input != 0 and make an animation transition in your character's animator from your idle animation to the walk animation if said boolean is true and back to idle if it's not.

  • @thewaterleaf7929
    @thewaterleaf7929 5 років тому

    how do you code springs?

  • @PavelNebo
    @PavelNebo 5 років тому +1

    This solution has a bug. When u jump before the colliding the ladder, and then collide it - u fly very fast cuz gravity becomes zero;

    • @sarahcruz2103
      @sarahcruz2103 5 років тому

      i have the same issue, advice?

    • @beri4138
      @beri4138 4 роки тому

      @@sarahcruz2103 Set the rigidbody's vertical speed to some constant value when climbing the ladder. It will override whatever speed you had before.
      rb.velocity.y = climbspeed;

  • @1Angelainwonderland
    @1Angelainwonderland 4 роки тому

    I've got this code working in my game but for some reason, it only works when the scene is "preloaded" and played from the editor but when I load it in while playing via a button it doesn't work and I don't know what to do...

  • @Sam-bd6gg
    @Sam-bd6gg 4 роки тому +1

    Can anyone tell me what is the game that Noa was playing at 7:26

  • @mm35b85
    @mm35b85 3 роки тому

    Hi, when i try to go up to stairs, automatically the gravity Scale is going to 1 (like, just for 1 frame goes to 0 and then is going back to 1), also, detect the ladder just for 1 frame, idk whats is happening :/
    (I dont speak english, but i hope you can understand)

  • @swordmaster3005
    @swordmaster3005 5 років тому

    Hey I need help I'm trying this out exactly yet my box keeps slowly sliding off if it isnt dead center to the ladder. Can someone put any possibilities?

  • @jumpskull
    @jumpskull 5 років тому +2

    doesn't work, my character is look like jumping when i holde up arrow key, then he back land to the ground...help

    • @joeym2383
      @joeym2383 5 років тому +1

      You probably didn't set the gravityscale to 0

    • @vidgrod695
      @vidgrod695 5 років тому

      @@joeym2383 I set mine to 0 but it still does it

    • @joelpersson9146
      @joelpersson9146 5 років тому

      @@vidgrod695 Did you set the layer of the ladders?

    • @vidgrod695
      @vidgrod695 5 років тому

      @@joelpersson9146 Yup, I think its just messing with my player controller code.

    • @nuku142
      @nuku142 5 років тому

      @@vidgrod695 did you set the ray distance in the Inspector? had the same problem until i realised it's set to 0 which means that my Player shoots a ray up with no distance -> no ladder detected -> player jumps instead of climb

  • @Gudies
    @Gudies 2 роки тому

    for some reason my characters raycast finds it hard to collide with the damn ladder does anyone know what could be the problem?

    • @deadkilla03
      @deadkilla03 2 роки тому +1

      don't know if you figured it out but use get key instead of getkeydown works great now

  • @mtebid5658
    @mtebid5658 3 роки тому

    When I push up arrow key he going up when I dont press the up arrow key and he stop it's work but if I keep pushing the up arrow key my player going to clouds and hangs in the air why he doesnt fall the ground.

    • @mtebid5658
      @mtebid5658 3 роки тому

      It work. Finally. It is necessary to pay attention to this sign next to the else and if commands "{" it does not work if you do not write it properly. Be careful if you type the code inside or outside this --> "{".

    • @mtebid5658
      @mtebid5658 3 роки тому

      private void FixedUpdate()
      {
      inputHorizontal = Input.GetAxisRaw("Horizontal");
      rb2d.velocity = new Vector2(inputHorizontal * speed, rb2d.velocity.y);
      RaycastHit2D hitInfo = Physics2D.Raycast(transform.position, Vector2.up, distance, whatIsLadder);
      if(hitInfo.collider != null)
      {
      if(Input.GetKey(KeyCode.W))
      {
      isClimbing = true;
      }
      }
      else
      {
      rb2d.gravityScale = 5;
      isClimbing = false;
      }
      if(isClimbing == true)
      {
      inputVertical = Input.GetAxisRaw("Vertical");
      rb2d.velocity = new Vector2(rb2d.velocity.x, inputVertical * speed);
      rb2d.gravityScale = 0;
      }
      else
      {
      rb2d.gravityScale = 5;
      }
      }//fixedUpdate end
      here is my code. copy and paste this I hope it work your project :)

  • @notNNK
    @notNNK 4 роки тому

    at this point i have literaly copy pasted the code and it is not working as it shoud, most of the times it just doesnt work, but when it does when i press the "up" key on the ladder my "player" does a jump instead of letting me move up and down, also every time i try to use the ladder the "player" gets pushed to the left

    • @mehtabahmed4694
      @mehtabahmed4694 4 роки тому

      {
      public Rigidbody2D rb;
      public float horizontal;
      public float vertical;
      public float speed = 3f;
      private bool onladder;
      public float distance;
      public LayerMask ladder;
      public float climbingspeed = 4f;
      //this a movement script
      void FixedUpdate()
      {
      horizontal = Input.GetAxisRaw("Horizontal");
      rb.velocity = new Vector2(horizontal * speed, rb.velocity.y);
      RaycastHit2D hitInfo = Physics2D.Raycast(transform.position, Vector2.up, distance, ladder);
      if (hitInfo.collider != null)
      {
      if (Input.GetKey("w"))
      {
      onladder = true;
      }
      else
      {
      onladder = false;

      }
      }
      if (onladder == true)
      {
      vertical = Input.GetAxisRaw("Vertical");
      rb.velocity = new Vector2(rb.velocity.x,vertical*climbingspeed);
      rb.gravityScale =0;
      }
      else
      {
      rb.gravityScale = 5;
      }

      }
      }

    • @notNNK
      @notNNK 4 роки тому

      that changed nothing is not the keys that dont work, is the gravity that is not working, plus "GetKey("W")" doesnt exist

    • @mehtabahmed4694
      @mehtabahmed4694 4 роки тому

      @@notNNK yeah i noticed it you should add the following code:
      if(Input.GetKey("a")
      {
      onladder =false
      }
      if(Input.GetKey("d")
      {
      onladder =false
      }

  • @bunggo9914
    @bunggo9914 6 років тому

    I think you don't need to put the movement code there, it's already in your previous videos...

  • @malibaturhan
    @malibaturhan 6 років тому

    The character doesn't fall down when I press left or right (It falls with a very low speed) but when I release the button it falls like it supposed to be. Why this happens?

    • @taij.9961
      @taij.9961 6 років тому

      I would just recheck the code. Make sure you have it right, your probably missing a piece. Or your changed gravity could be low. He used 5, so use a number around their. Hope this helps!

  • @yunes2099
    @yunes2099 6 років тому

    hello i have a simple question i want to know how i can disappearance and appearance an object in 2d game

    • @beri4138
      @beri4138 4 роки тому

      You can use the alpha channel of SpriteRenderer to set transparency.

  • @seifmustafa2004
    @seifmustafa2004 6 років тому +1

    5Th :D?

  • @AozoraOrigami
    @AozoraOrigami 4 роки тому

    no ladder climbing happens for me :/

  • @hopium9963
    @hopium9963 5 років тому

    Mine isn't working, Do you guys know why it isn't? It goes up for a seconds and then falls back down.

  • @FF-ie6sd
    @FF-ie6sd 5 років тому

    please help! I cant move my character. Do I need write a script for my character to move?

    • @DD-kt6lf
      @DD-kt6lf 5 років тому

      Yes, you should be able to move by writing the script showed in the video, once you write it drag and drop it into your character and don't forget to set your speed

    • @beri4138
      @beri4138 4 роки тому

      Omg

  • @cyphernil4416
    @cyphernil4416 6 років тому

    Why do you use raycasting inside an update loop when the documentation explicitly states its computationally expensive and is bad practice. A box collider or layer based collision makes more sense?

    • @beri4138
      @beri4138 4 роки тому +2

      It's ok he's not making gta 6

  • @shov3340
    @shov3340 5 років тому

    if (hitInfo.collider != null)
    {
    if (Input.GetKeyDown(KeyCode.UpArrow) || !isGrounded)
    {
    isClimbing = true;
    }
    }

  • @vitprokopev3380
    @vitprokopev3380 Рік тому

    And how to jump up the ladder 0:25

  • @mondegaming6095
    @mondegaming6095 4 роки тому

    hey, my character wont latch onto the ladder. Please help :(

    • @beri4138
      @beri4138 4 роки тому

      Make rb.velocity.x = 0 while climbing the ladder.

  • @iwar2660
    @iwar2660 2 роки тому

    This just dont work for me

  • @sebastiancastro5686
    @sebastiancastro5686 4 роки тому +2

    What if I use GetAxisRaw("Vertical")? Mediocre tutorials, as usual.

  • @subzero4787
    @subzero4787 3 роки тому +1

    It looks too bad without animation...

  • @MikeKing710
    @MikeKing710 6 років тому +1

    Second!

  • @muhammadadnan9277
    @muhammadadnan9277 6 років тому

    i recently started unity as developer but i known basics concepts about C#..... am not good in coding, how i will become a good developer????

  • @fabgg_
    @fabgg_ 6 років тому

    Arretes de sécher et vient en cours.

  • @kapitanmartin
    @kapitanmartin 3 роки тому

    not ver good for begginers you are too fast and in your code are some weird spaces :(

  • @Stich6261
    @Stich6261 5 років тому

    Easy?

  • @pranavpanchal7648
    @pranavpanchal7648 6 років тому +1

    First 😁

  • @pulsar1934
    @pulsar1934 2 роки тому

    Ok, but those ladders are shit. Heroe is not center