Colliders, collisions and upper walls in rpg games

Hello!
I’m starting a 2d game development, and while inspecting most critical points, i encountered a problem about an apparently simple thing.
It is an rpg, so i will take NES legend of zelda as example, to explain better my issue. If you can’t remember well the game, i will link a youtube video:

What is achieved there is the behaviour of the character against different walls/objects: going down, Link stops as soon as his feets rrach the obstacle, and you can’t see any graphic overlaps. Instead, walking up, Link can overcome the obstacle just for a portion of his body, giving the perception of deepth. So, any suggestion to achieve this?
I made a drawing (i’m not good at it, sorry!), as you can see the character’s collider prevent, in the right way, to go over the lower wall, but, on the upper wall, if i make the box smaller, i achieve the effect, but enemies will have a little box to hit the player, and i don’t want it, and if i keep the collider the same, the head stops as soon as he reaches the obstacle.

Thanks in advance, have a nice day!

Kaem

You can have more than one collider on your player. Use one for melee hit detection and the other for collisions.

Oh… Thank you!