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 - วิทยาศาสตร์และเทคโนโลยี
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!
i love the description of the player sprite
Straight to the point, easy to follow. Thank you!
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.
great tutorial, just what i was looking for after trying several complicated methods to no avail. keep up the great work!
this is so straight to the point. thank you for this :)
i hope you discuss something like grappling hooks
had a problem with a wall climbing mechanic using raycasts, you vid helped a ton. thanks dude!
you nailed it. i was looking for this code. the other ladder codes on youtube didnt work as well as this one.
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
Awesome tutorial! Was really simple to follow and worked amazingly!
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.
Thank you for sharing!
thx, that help me :3
you just saved my project, thank you very much
dude, you should make more videos tutorial. Your explanations is amazing
perfect video mate well done
это реально классные видео уроки по той причине что они работают я часто сталкивался с проблемой что ни один код или способ их применения не работал , однако все способы этих видеоуроков работают безотказно
This is gold. Thank you
very good tutorial, thanks!
thanks. Really needed this for my platformer game XD. SUBBED
It works!! Thank you very much!!
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
Good job man!
I know this video is a bit old but is there a way to do the script in the unity script graph
thanks for the code bro!
i love your videos so much keep going
Man, you're a beast!
Thank you it worked
What needs to be done to stop direction while jumping. Great vids
Join our Discord server, and let's solve your problem together!
how i play my climb animation Please Help
Thank u so much man!
"Boom! Ladder" Boom ! subscribed
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?
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
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.
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
You're a good man
that was awesomeee
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?
Add a Box Collider 2D component to it and make it a trigger.
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.
You could create an invisible one-way platform above the ladder.
u saved me thanks a lot.
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
What kind of error message do you get?
Keep it up
Now I wasnt gonna say it so im glad you did 0:45
Thankyou soooo much.
Thank you
Just a quick question, how do you get code proposals when you write ? Do you use a particular "intellisense" extension ?
learn.microsoft.com/en-us/visualstudio/gamedev/unity/get-started/getting-started-with-visual-studio-tools-for-unity
@@bendux Thank you very much, it works !
Thanks ❤❤
Спасибо, всё отлично работает!
OKE
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?
You could create an invisible one-way platform above the ladder.
@@bendux ill try it and let you know how it works. thats not a bad idea
I get an error that says Inout Axis vertical is not setup
Would you like to show me your code on Discord?
thank you
Hello!!
It goes up perfectly but then when I pass through the ladder it falls down...
You could create a one-way platform to prevent the player from falling down the ladder.
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 ?
EDIT: Nevermind I am dump forgot istrigger on boxcollider
@@johndee2091 I'm glad you were able to fix it.
@@johndee2091 i have the same issue? is it to do with the player or ladder?
Does this method also work in 3D? maybe with a few changes
Unfortunately, I haven't tried it yet, but it should also work in 3D.
Where can i find the ladder?
What do you mean?
How do uou get down tho? the box collider for the platformsa is stopping it.
You could turn the platform into a one-way platform.
@@bendux tried that, doesn't work.
@@random_precision_software Would you like to show me your code on Discord?
Who wants to see the ladders professor go higheeer!
It worked perfect! but for some reason it interferes with my player's ability to jump... I still haven't figured out why.
We have a solution for that on our Discord server. Feel free to join!
btw what is the game you are playing in intro and outro
The game is called Broforce.
@@bendux thanks
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?
I've added a link to the source code to the description.
Awesome video! Could you create a video using the new unity Input System?
We have a solution for that on our Discord server. Feel free to join!
hi i was wondering how to exit the ladder without an impulse...
What do you mean?
How to jump while you on ladder ??
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!
What is the name of the game that appears at the beginning?
The game is called Broforce.
@@bendux Thank you!
It docent work for me beacuse of SerializeField do you know why?
Oo i made it work btw your videos are so ez to follow :))
My ladder dident work :( it might have to do with mu charecter tho..
My*
Would you like to show me your code on Discord?
That wall slide was pretty cool , do you have a tutorial for that? ♡
Do you mean the wall slide from Broforce?
@@bendux is that the name of the game at the start and end? If so yes ♡
The character does a little wall slide climb thing at 4:08
@@TransGuyShane Unfortunately, I don't have a tutorial, but I can try to make one in the future.
@@bendux that would be awesome.
No need to push yourself but it would be nice to see one :)
i dont know why but i cant go up even when im in range
It's hard to tell what's going on without seeing your script.
can you make an enemy attack video
I've never created enemies in Unity before, but I can definitely give it a try.
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
It probably has something to do with my video editing software. I'm sorry!
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.
Would you like to show me your code on Discord?
0:44 😭😭💀
Nice player explation lol
Hehe, Denis
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.
You pronounce "player" pretty much like brackeys. Are you from Sweden too?
Haha, I'm actually from Germany.
this script keeps crashing my unity
Would you like to show me your code on Discord?
@@bendux i just pre applied the code then wrote it and it worked, unity is strange ( i copy pasted btw
@@dreadge I'm glad you were able to fix it.
This is not ladder movement, It’s just a levitation of player object. The climbing is not natural at all
1k
bad totural
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;
}
}
}