Add 'crawl' behavior to level. Use prettier options for saving level, since we're...
[koperkapel.git] / koperkapel / roaches.py
index 904b8c7dfc9bdf927018cb200372080ce97ca635..653f085aa6a39f4a64ebc2d9d89311da2dad0f42 100644 (file)
@@ -5,12 +5,7 @@ from pgzero.clock import each_tick
 from pgzero.loaders import images
 from pygame.constants import BLEND_RGBA_MULT
 from .actors.surf import SurfActor
-
-ROACH_COLORS = {
-    "blue": (0, 0, 255, 255),
-    "green": (0, 255, 0, 255),
-    "purple": (255, 0, 255, 255),
-}
+from .serums import roach_serum_color
 
 
 class RoachActor(SurfActor):
@@ -37,19 +32,16 @@ class RoachFactory:
         self.suffix = suffix
         self.frames = 4
 
-    def roach_color(self, roach_data):
-        return random.choice(list(ROACH_COLORS.values()))
-
     def assemble_frame(self, i, color, roach_data):
         roach = images.load("roach%s/roach_%d" % (self.suffix, i + 1))
         eyes = images.load("roach%s/eyes_%d" % (self.suffix, i + 1))
-        roach = roach.copy()
-        roach.fill(color, None, BLEND_RGBA_MULT)
-        roach.blit(eyes, (0, 0))
-        return roach
+        frame = roach.copy()
+        frame.fill(color, None, BLEND_RGBA_MULT)
+        frame.blit(eyes, (0, 0))
+        return frame
 
     def assemble(self, roach_data):
-        color = self.roach_color(roach_data)
+        color = roach_serum_color(roach_data)
         frames = [
             self.assemble_frame(i, color, roach_data)
             for i in range(self.frames)]