public int getDirectionToTarget(Avatar myAvatar, int xTarget, int yTarget){

        int x = myAvatar.getX();
        int y = myAvatar.getY();

        if(x < xTarget){
            if(y < yTarget){
                return 4;
            }else if(y == yTarget){
                return 3;
            }else{
                return 2;
            }
        }else if(x == xTarget){
            if(y < yTarget){
                return 5;
            }else if(y == yTarget){
                return -1;
            }else{
                return 1;
            }
        }else{
            if(y < yTarget){
                return 6;
            }else if(y == yTarget){
                return 7;
            }else{
                return 0;
            }
        }
    }