Help needed on making a TD game!

I am in the process of making a tower defense game and is was wondering if anyone could help me on how to make my turrets shoot when the badguy is in range. Thanks in advance. 

Game Editor discussion board
http://game-editor.com/forum/
range=distance(turret.x, turret.y, badguy.x, badguy.y);