From Game Editor
Revision as of 00:48, 4 May 2011 by Skydereign (Talk | contribs)
double distance(double x1, double y1, double x2, double y2);
distance returns the distance between point (x1,y1) and (x2,y2).
Example:
Shoot bullets if the player comes in range.
turret -> Draw Actor -> Script Editor
if(distance(x, y, player.x, player.y)<200)
{
timer++;
if(timer>=30)
{
CreateActor("bullet", "bullet", "(none)", "(none)", 0, 0, false);
timer=0;
}
}

![[]](http://game-editor.com/wiki/skins/blender/open.png)