How to make character move like beat'em up game ?

Hello everyone,

I’m creating a beat’em up game, and i’m stuck at movement part. I already made the first level (just a background).
I’d like to know how to allow character to move in depth, like previous beat’em up games ? I did simple movement/attack/animation script, but it’s only left/right/jump.
How can I make player move like described in this picture ? alt text

Many thanks to anyone who can help me.

This movement is very similar to top-down 2D movement, but you want to find a different direction to move instead of straight up and down. Here is some sample code with some comments to help explain:

// angles relative to right being 0 degrees (pos goes up, neg goes down)
float upDownAngle = 55;
float stairsAngle = -45;
Vector3 upDownDirection;
Vector3 stairsDirection;
float speed = 10;
bool onStairs;

void Start()
{
    // turn angles into direction vectors
    upDownDirection = new Vector3(Mathf.Cos(upDownAngle * Mathf.Deg2Rad), Mathf.Sin(upDownAngle * Mathf.Deg2Rad));
    stairsDirection = new Vector3(Mathf.Cos(stairsAngle * Mathf.Deg2Rad), Mathf.Sin(stairsAngle * Mathf.Deg2Rad));
}

void Update()
{
    // correct for diagonal movement with normalized
    var moveInput = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")).normalized;

    if (moveInput.y != 0) {
        // apply with the new up/down direction vector instead of Vector3.up
        transform.position += moveInput.y * upDownDirection * speed * Time.deltaTime;
    }

    if (moveInput.x != 0) {
        // find some way to detect if on stairs
        if (onStairs == true) {
            transform.position += moveInput.x * stairsDirection * speed * Time.deltaTime;
        } else {
            // else move normally
            transform.position += moveInput.x * Vector3.right * speed * Time.deltaTime;
        }
    }
}

You will need to find some way to detect when you are on the stairs. This is assuming you only want to go down stairs.

Many thanks @ymrasu for that exhaustive answer.
Does that sample can be used “as is” ?
My first 2D character controller was from basic assets pack on Unity store + an animator script I wrote for punch/kick/walk/idle animations.