Arrow shooting combat system

Hey all,

Been a long time since I’ve been on here with high school and all. Working on a basic little combat system at the moment. All it is is one MC for the character, one for the enemy and one for the arrow. Shooting the arrow, rotation all that is fine, the only problem i’m having is finding a good way to set the speed of the arrow. At the moment i’m using:

    if (_root.Xdistance<_root.Ydistance) {
        _root.movex = 1;
        _root.movey = _root.Ydistance/_root.Xdistance;
    } else if (_root.Xdistance>_root.Ydistance) {
        _root.movex = _root.Xdistance/_root.Ydistance;
        _root.movey = 1;
    }

For most times it works fine, eg if the Xdistance is 5, Ydistance is 10, u get movex of 1, naturally, and movey of 2, meaning it moves towards the target along the angle perfectly, but when you get a bigger gap between the distances the speed greatly increases, for example Xdistance is 5, Ydistance is 150, you get one again for movex, but you get 30 for movey and as you can imagine, it will move rather fast.

I’ve tried different ways to get a good speed function working but this is the best i could come up with =/ if anyone has some ideas/suggestions then that’d be great. Thanks in advance -

-Grant

p.s. i have looked on the internet for ideas but couldnt find anything

Edit: thought id upload the .fla