How do i make a tap mechanic for player attack?

I am making a game where enemies spawn from either side of the screen and try to destroy the base in the middle. whenever the player taps i want the hero to go to the nearest enemy and with the continuous taping attack that enemy until it dies and then move to the next enemy and so on. what would be the easiest way to achieve this?