Character movement

Hey people. I’m trying to get something done with character movements, but I can’t seem to get something right. Using the if (Key.isDown) things doesn’t seem right, and has a few glitches.

I’m trying to have it to where when I press up, down, left or right, the character moves in that direction, but when you press up and right, for example, to go diagonal, I don’t want the other codes interfering with it.

For example, this is the code that I started off with:



onClipEvent (enterFrame) {
    
    speed1 = 4
    speed1a = 2.8
    
    if (Key.isDown(Key.RIGHT)) {
        this.gotoAndStop (4)
        _x+= speed1
    }
    
    if (Key.isDown(Key.LEFT)) {
        this.gotoAndStop (3)
        _x-= speed1
    }
    
    if (Key.isDown(Key.UP)) {
        this.gotoAndStop (2)
        _y-= speed1
    }
    
    if (Key.isDown(Key.DOWN)) {
        this.gotoAndStop (1)
        _y+= speed1
    }
}

speed1 is the normal speed, and speed 1a is the speed that I want the character to move with diagonaly. I just can’t seem to get it right, using different methods, I can’t get it. Could someone help me out?

Thanks[color=DeepSkyBlue]

!GB! - PEACE -
[/color]