They are looking for either a food source or a new home. Smashing the odd one here and there is OK but when they invade in numbers it is time to use bait. I prefer combat gel, but there are many out there. You want the bait/s placed in their trails, their main paths, may take a bit of watching to figure them out. The idea is they take the bait back to the nest and it kills them all from there. If it is an effective bait for those particularly ants, You'll see an increase of activity around the baits then, after 3 or 4 days, they will all be gone.