Hello there. I am currently building a tower defense game and I am currently a little stuck at drawing a range indicator around the attacker. The plan is to use the following function to draw a circle around the attacker at its max. range of operation. The range is stored in a variable as an integer and also used to calculate the distance between attacker and target:
eg:
var range = 500
if attacker.global_position.distance_to(target.global_position) < range:
shoot()
Draw function
func draw_circle_arc(center, radius, angle_from, angle_to, color):
var nb_points = 2048
var points_arc = PoolVector2Array()
for i in range(nb_points+1):
var angle_point = angle_from + i*(angle_to-angle_from)/nb_points - 90
var point = center + Vector2( cos(deg2rad(angle_point)), sin(deg2rad(angle_point)) ) * radius
points_arc.push_back( point )
for indexPoint in range(nb_points):
draw_line(points_arc[indexPoint], points_arc[indexPoint+1], color, 2)
In my understanding the range
should be the radius of the circle but however the circle is way to big when given the range
as the radius.

This is what I want to achieve. The circle is located right where the attacker starts shooting the targets. But in this case I had to divide the range by 5 to get this result. Otherwise it would be way to big. So my question is: How can I manage to use the same distance/range variable for both checking the shooting range and drawing the range indicator? Aren't both using pixel measurements?
Thanks in advance!