Enemy shooting when running

How can I make the enemy’s shoot me and apply damage to my player? The enemy has to ,Run’’ towards my player in the distance 160 pixels, but when he is in 30 pixel range he has to shoot my player. help

You have a condition to check distance between two objects, just use it with the desired distance amount.

About the movement you can use what you want to use, TopDown movement, pathfinding, forces etc