Collision: Up Hills?

Hello everyone!

Recently I’ve been making a game for a class, and all was going well with collision detection until I tried to make my character move uphill.

Logically: I think the code should work, and was wondering if anyone here can take a look and see what I may be doing wrong.

toon - Character that appears on screen.
checker - Invisible toon that checks for collisions before moving visible toon.
PixelPerfectCollision.isColliding - Separate class used for precise collision detection.
Direction - Which way I’m moving

private function MoveX():void 
        {
            checker.x = toon.x + (Math.sqrt((Speed*Speed)-(b*b)))*Direction;
            while (!PixelPerfectCollisionDetection.isColliding(checker, world, this, true) && Direction !=0 && b>0)
            {
                checker.y = toon.y += 1;
                toon.y = checker.y;
                b = 0;
                
            }
               while (PixelPerfectCollisionDetection.isColliding(checker, world, this, true) && Math.abs(checker.x - toon.x) >= 1 && b<=Speed //45 degree hill max) 
               {
                b++;
                checker.y = toon.y - b;
                checker.x -= Direction;
            }
            toon.x = checker.x;
        }

I tried messing around in all sorts of way, and reordering the code, but I still either get choppy movement + toon randomly spazzing out of the map, or I get an infinite loop and the flash player crashes.

Heres my Y-axis movement function:


private function MoveY():void 
        { 
              if (Vely < 0) 
            { 
                      Direction2 = -1;
               } 
                   else 
               { 
                B = 0;
                     Direction2 = 1;
            }
            
               checker.y = toon.y + Vely; 
               while (PixelPerfectCollisionDetection.isColliding(checker, world, this, true)) 
               { 
                 Vely = 0;
                  checker.y -= Direction2;
                if(Direction2==1)
                {
                    Jumped = false;
                }
               } 
               if (Vely != 0)
              { 
                  toon.y = checker.y;
               }
        }

Any help would be appricated, thank you!