It is not optimal since every 1 seconds uses the global time, so it will happen that the squirrel will not fire the bullet immediately when you come into range. That might not seem that big of a deal in this case, but in other cases where the time intervall is bigger (like 5 seconds) this becomes really inconsistent.
I'd prefer a construction like (cd = instance variable of squirrel):
every tick
cd > 0: substract dt from cd
distance(hero.x,hero.y,squirrel.x,squirrel.y) < range AND cd less or equal 0: fire bullet, set cd to (your cooldown time)