Slopes AS2

Hey, just joined this site.

I’ve actually been looking for a proper way to do this for a really really long time, and I’ve only come close once.
Basically, I’m trying to make a game with a character that moves upwards/downwards with the angle of the ground he’s walking on. (He doesn’t have to rotate)

Sounds simple enough. I can’t even tell you how many different approaches I’ve taken. In both AS2 AND AS3.

I’ll attach an fla of where I’ve come close. What I can’t figure out is how to make it precise (as in no rumbling while walking up, and no falling when walking down)
A bonus would be: Sliding down if the downward slope is great enough.

Here’s the code in P1:

onClipEvent (load) {
    var jumping:Boolean = true;
    var jump:Number = 0;
    var wallleft:Object = {x:350, y:200};
    var wallright:Object = {x:375, y:200};
    var slideleft:Object = {x:350, y:235};
    var slideright:Object = {x:375, y:235};
    var catcher:Object = {x:362.5, y:245};
    var charpoint:Object = {x:362.5, y:250};
}
onClipEvent (enterFrame) {
    _root.ground._y += jump;
    if (jump<=-10) {
        jump = -9;
    }
    if (_root.ground.hitTest(charpoint.x, charpoint.y, true)) {
        jump = 0;
        jumping = false;
        _root.ground._y -= 5;
    } else {
        jumping = true;
    }
    if (_root.ground.hitTest(catcher.x, catcher.y, true)) {
        _root.ground._y += 5;
    }
    if (_root.ground.hitTest(wallleft.x, wallleft.y, true)) {
        _root.ground._x -= 5;
    } else {
        if (_root.ground.hitTest(slideleft.x, slideleft.y, true) && jumping == false) {
            if (Key.isDown(Key.LEFT)) {
                _root.ground._y += 5;
            }
        }
    }
    if (_root.ground.hitTest(wallright.x, wallright.y, true)) {
        _root.ground._x += 5;
    } else {
        if (_root.ground.hitTest(slideright.x, slideright.y, true) && jumping == false) {
            if (Key.isDown(Key.RIGHT)) {
                _root.game.stage._y += 5;
            }
        }
    }
    if (_root.roof.hitTest(wallleft.x, wallleft.y, true)) {
        jump = -5;
    }
    if (_root.roof.hitTest(wallright.x, wallright.y, true)) {
        jump = -5;
    }
    if (Key.isDown(Key.SPACE) && jumping == false) {
        jumping = true;
        jump += 15;
    }
    if (jumping == true) {
        jump -= 1;
    }
    if (Key.isDown(Key.LEFT)) {
        _root.ground._x += 5;
    }
    if (Key.isDown(Key.RIGHT)) {
        _root.ground._x -= 5;
    }
}


I’m using Flash 8 if that helps anyone.