From 73f0ef7fd327e5376b4d6b27f88cefac25c484d1 Mon Sep 17 00:00:00 2001 From: group1 Date: Sun, 16 Oct 2016 22:41:14 -0400 Subject: Eel --- fish_types.py | 19 ++++++++++++------- 1 file 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) -- cgit v1.3.1