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),
- "brown": (170, 68, 0, 255),
-}
+from .serums import roach_serum_color
class RoachActor(SurfActor):
self.suffix = suffix
self.frames = 4
- def roach_color(self, roach):
- if roach.smart:
- return ROACH_COLORS["blue"]
- elif roach.fast:
- return ROACH_COLORS["green"]
- elif roach.strong:
- return ROACH_COLORS["purple"]
- return ROACH_COLORS["brown"]
-
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))
return roach
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)]
--- /dev/null
+""" Tools for creating serum actors. """
+
+
+SERUMS = ["smart", "fast", "strong"]
+
+SERUM_OVERLAY_COLORS = {
+ "smart": (0, 0, 255, 255), # blue
+ "fast": (0, 255, 0, 255), # green
+ "strong": (255, 0, 255, 255), # purple
+ "none": (170, 68, 0, 255), # brown
+}
+
+
+def roach_serum_color(roach):
+ for serum_name in SERUMS:
+ if getattr(roach, serum_name):
+ return SERUM_OVERLAY_COLORS[serum_name]
+ return SERUM_OVERLAY_COLORS["none"]
self._build_roach("roichard", fast=True),
self._build_roach("roupert"),
]
+ state["serums"] = [
+ "smart", "strong", "fast",
+ ]
state["vehicles"] = {
"current": "walking",
"available": ["walking"],