distance(x1, y1, x2, y2) Calculate distance between to points
It's pretty self explanatory. Say you have a player and an enemy
distance(player.x, player.y, enemy.x, enemy.y) will return the distance from those 2 objects.
So if you want the enemy to shoot when the player is closer than 200 pixels:
If distance(player.x, player.y, enemy.x, enemy.y) < 200
- Trigger enemy shooting event/function/group