diff options
Diffstat (limited to 'fish_show.py')
| -rw-r--r-- | fish_show.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fish_show.py b/fish_show.py index 51693e4..d42e520 100644 --- a/fish_show.py +++ b/fish_show.py @@ -52,7 +52,7 @@ class Fish(object): if self.x < -self.width: self.x = constants.BRIDGE_WIDTH - print(self.x, self.y) + #print(self.x, self.y) def fix_direction(self): min_theta = -0.32 @@ -145,12 +145,17 @@ class FishShow(Show): self.lights = [Light(x, y, self.bridge.get_light(x, y)) for y in xrange(self.bridge.HEIGHT) for x in xrange(self.bridge.WIDTH)] - random_hue = random.random() - fish_color = color.HSV(random_hue, 1, 20/100).to_RGB() - self.fishes = [Fish(0, 0.5, 23, 1.5, fish_color, 1), Fish(100, 0.5, 23, 1.5, fish_color, 1)] + self.fishes = [] + self.send_event('new creature', {'name': 'test fishy'}) def update(self): + event = self.recv_event() + if event and event[0] == 'spawn': + random_hue = random.random() + fish_color = color.HSV(random_hue, 1, 20/100).to_RGB() + self.fishes.append(Fish(0, 0.5, 23, 1.5, fish_color, 1)) + for fish in self.fishes: fish.update() for light in self.lights: |
