From: Skullheadx <94652084+Skullheadx@users.noreply.github.com> Date: Fri, 24 Nov 2023 04:08:57 +0000 (-0500) Subject: Update particle.py X-Git-Url: http://git.skullheadx.com/nixos/static/gitweb.css?a=commitdiff_plain;h=304a37c326405fe4b0869ac0ea7beee9bbba439e;p=Electric-Dipoles.git Update particle.py --- diff --git a/particle.py b/particle.py index ae762e2..f1c6f24 100644 --- a/particle.py +++ b/particle.py @@ -10,6 +10,7 @@ class PointParticle: BLUE = (0, 153, 255) RED = (255, 43, 0) + step_amount = 10 def __init__(self, position, charge=1.6e-19): self.position = pygame.Vector2(position) @@ -24,7 +25,7 @@ class PointParticle: self.field_line_angles = list(range(0, 360, int(360 / self.num_field_lines))) # List of angles self.field_lines = [[] for _ in range(self.num_field_lines)] - self.line_step = pygame.Vector2(10, 0) if self.charge > 0 else pygame.Vector2(-10, 0) + self.line_step = pygame.Vector2(self.step_amount, 0) if self.charge > 0 else pygame.Vector2(-self.step_amount, 0) def update(self, delta, particles): if self.dragging or not (True in [p.dragging for p in particles]): @@ -64,7 +65,7 @@ class PointParticle: direction = math.atan2(electric_field_y_net, electric_field_x_net) self.field_lines[field_line_index].append(position.copy()) - if end == True: + if end: break def draw(self, surf):