Yee
March 19, 2022, 4:36pm
2
Hi! Welcome to the community!
This is a very common issue, as to how to solve it there’s no easy answer, there are multiple threads here in the forum that have tried to solve this and make the whole climb ladders system more flexible, you can get inspiration from those threads. Here’s are some of those threads:
Hey guys,
So, I took on the Mega Challenge before watching the rest of the video. I really wanted to work this one out, so it took me several days, but I’m glad I made the “detour” (:
https://community.gamedev.tv/uploads/short-url/8zdtRPS1WY3L7fkCsEY1zdpEw2e.mp4
From the video, it doesn’t look like much, but there’s quite a bit going on under the hood. Mainly because the player sprite is not confined to a single tile space (this collider is actually one tile wide by two tiles high).
[1-playe…
I thought that it was weird for the main player to look like he is standing on the ladder. So I made a new animation with one of the climbing sprites. I also made a new animator state that I named “ClimbIdling” and made a new bool named “isClimbIdling” in the animator.
[image]
Here’s my climbLadder code:
private void ClimbLadder()
{
if (!_collider2D.IsTouchingLayers(LayerMask.GetMask("Climbing")))
{
ResetClimbingState();
return;
}
float controlThrow = CrossPla…
So, it was bugging me when I could not jump from the ladder. The basic problem I found was that the climb method changes the vertical velocity on the next frame when it is called after the jump. That way it stops even though it jumps. Even if jumping to the side, there is not enough movement in one frame to stop touching the ladder. I have implemented a coroutene that sets a jumping boolean for a very small time to true and then turns it back to false. The climbing functions only happen when the…