summaryrefslogtreecommitdiffstats
path: root/fish_types.py
diff options
context:
space:
mode:
authorgroup1 <f16_group1@pbridge.adm.cs.cmu.edu>2016-10-16 23:05:41 -0400
committergroup1 <f16_group1@pbridge.adm.cs.cmu.edu>2016-10-16 23:05:41 -0400
commit65d62033231e7ba8e99b341aa13a6ed2b63920a6 (patch)
tree3cd09acb1d18f6ca0a97001d85753ade694317b9 /fish_types.py
parent73f0ef7fd327e5376b4d6b27f88cefac25c484d1 (diff)
downloadbridge-65d62033231e7ba8e99b341aa13a6ed2b63920a6.tar.zst
Jellyfish
Diffstat (limited to 'fish_types.py')
-rw-r--r--fish_types.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/fish_types.py b/fish_types.py
index d37a259..ce15703 100644
--- a/fish_types.py
+++ b/fish_types.py
@@ -26,6 +26,7 @@ class Fish(object):
self.y = 0.5
self.speed = C.Vector(0, 0)
self.tailAcceleration = C.Vector(self.tailAccelMag, 0)
+ self.tailThresholdCurrent = self.tailThreshold
self.tailMoving = False
self.tailMoveCount = 0
if not hasattr(self, 'theta_scale'):
@@ -58,9 +59,11 @@ class Fish(object):
return False
self.speed += self.drag * self.speed
- if abs(self.speed) < self.tailThreshold:
+ if abs(self.speed) < self.tailThresholdCurrent:
self.tailMoving = True
- self.tailThreshold = rand_in_range(0.5, 1.4)
+ self.tailThresholdCurrent = max(rand_in_range(
+ self.tailThreshold - 0.1, self.tailThreshold + 0.1
+ ), 0.0001)
self.fix_direction()
if self.tailMoveCount > self.tailDuration:
self.tailMoveCount = 0
@@ -100,12 +103,12 @@ class Fish(object):
class Jellyfish(Fish):
color = C.HSV(298/360, 89/100, 53/100).to_RGB()
- drag = -0.01
+ drag = -0.1
width = 15
height = 1.5
- tailThreshold = 0.001
- tailDuration = 4
- tailAccelMag = 0.001
+ tailThreshold = 0.2
+ tailDuration = 6
+ tailAccelMag = 0.25
class Dolphin(Fish):