Skip to content

Commit 74506c5

Browse files
committed
Restored original dt method, works better.
1 parent 9a43621 commit 74506c5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pynboids.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def update(self, allBoids, dt, fps, ejWrap=False): # boid behavior
3939
selfCenter = pg.Vector2(self.rect.center)
4040
curW, curH = self.drawSurf.get_size()
4141
turnDir = xvt = yvt = yat = xat = 0
42-
turnRate = 2.4 * fps * dt # too high might cause spinning
42+
turnRate = 124 * dt #2.4 * fps * dt
4343
margin = 48
4444
neiboids = sorted([ # gets list of nearby boids, sorted by distance
4545
iBoid for iBoid in allBoids
@@ -83,7 +83,7 @@ def update(self, allBoids, dt, fps, ejWrap=False): # boid behavior
8383
self.image = pg.transform.rotate(self.orig_image, -self.angle)
8484
self.rect = self.image.get_rect(center=self.rect.center) # recentering fix
8585
self.direction = pg.Vector2(1, 0).rotate(self.angle).normalize()
86-
next_pos = self.pos + self.direction * (3.5 + (7-ncount)/14) * fps * dt
86+
next_pos = self.pos + self.direction * (180 + (7-ncount)**2) * dt #(3.5 + (7-ncount)/14) * (fps * dt)
8787
self.pos = next_pos
8888
# optional screen wrap
8989
if ejWrap and not self.drawSurf.get_rect().contains(self.rect):

0 commit comments

Comments
 (0)