private Enemy withinRange(int tp)
    {
        List<Actor> temp = getObjectsInRange(range/2, Enemy.class);
        ArrayList<Enemy> enemyList = new ArrayList();
        Enemy targetEnemy = null;
        if (temp.size() > 0){
            if (tp == 1){
                Enemy e;
                double hyp = range;
                for (int i = 0; i < temp.size();i++)
                {
                    if (temp.get(i) instanceof Enemy) 
                    {
                        e = (Enemy) temp.get(i); 
                        if (e.getHp() > 0 && e.getTargetHp() > 0){
                            double h = getDistance (e);
                            if (h < hyp){       
                                //if the current hyp is less than the starting hyp
                                hyp = h;
                                targetEnemy = e;
                            }
                        }
                    }
                }
            }
        }
        //System.out.println(enemyList);
        return targetEnemy; 
    }