Im not too familiar with threading but I thought I shoud use it for a physics test program I made with scene
Is it a good idead to start a new thread like this every time or should I do this a different way?
(This basically checks to see if the circles collide with each other and changes color if it happens; and this is only a portion of the program)
def update(self):
for circle in self.circles:
_thread.start_new_thread(self.check_collision, (circle, ))
def check_collision(self, circle):
for other in self.circles:
if circle != other:
dx = circle.position.x - other.position.x
dy = circle.position.y - other.position.y
if math.hypot(dx, dy) < (circle.radius + other.radius):
circle.color = COLLIDE_COLOR
break
else:
circle.color = CIRCLE_COLOR