summaryrefslogtreecommitdiffstats
path: root/fish_types.py
diff options
context:
space:
mode:
authorgroup1 <f16_group1@pbridge.adm.cs.cmu.edu>2016-10-16 22:41:14 -0400
committergroup1 <f16_group1@pbridge.adm.cs.cmu.edu>2016-10-16 22:41:14 -0400
commit73f0ef7fd327e5376b4d6b27f88cefac25c484d1 (patch)
treee3ff1a4e895addbb0d723d0e92f65da431bfc801 /fish_types.py
parentd62c186e42bb84ef42db5097ef9f291a57197a7e (diff)
downloadbridge-73f0ef7fd327e5376b4d6b27f88cefac25c484d1.tar.zst
Eel
Diffstat (limited to 'fish_types.py')
-rw-r--r--fish_types.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/fish_types.py b/fish_types.py
index 61cd36a..d37a259 100644
--- a/fish_types.py
+++ b/fish_types.py
@@ -11,6 +11,9 @@ class Fish(object):
Must override color (or color_at), drag, width, height, tailThreshold,
tailDuration, tailAccelMag
"""
+
+ is_diamond = True
+
def __init__(self, x=None, y=None):
"""Create fish with default parameters."""
if x is not None:
@@ -219,27 +222,29 @@ class Stingray(Fish):
class Eel(Fish):
- color = C.HSV(109/360, 83/100, 35/100).to_RGB()
+ color = C.HSV(109/360, 83/100, 0/100).to_RGB()
drag = -0.09
- width = 50
+ width = 30
height = 2
tailThreshold = 0.7
tailDuration = 2
- tailAccelMag = 0.1
+ tailAccelMag = 0.2
front_offset = 0
y = 0
+ is_diamond = False
def alpha_at(self, x, y):
rel_x = x - self.x
- rel_y = y - self.y
eel_height = math.sin(
2 * math.pi * (rel_x + self.front_offset) / self.width
) / 2 + 0.5
- y_blend = abs(rel_y - eel_height)
- if y_blend > 0.5:
+ y_blend = abs(y - eel_height)
+ if y_blend > 0.75:
return 0
- return (1 - y_blend)
+ if y_blend < 0.25:
+ return 1
+ return 1 - y_blend
def update(self):
self.front_offset += abs(self.speed)