""" Tools for creating serum actors. """
+from pgzero.loaders import images
+from pygame.constants import BLEND_RGBA_MULT
+from .actors.surf import SurfActor
SERUMS = ["smart", "fast", "strong"]
+SERUM_TILENAME_MAP = {
+ "smart": "intelligence",
+ "fast": "speed",
+ "strong": "strength",
+}
+
SERUM_OVERLAY_COLORS = {
"smart": (0, 0, 255, 255), # blue
"fast": (0, 255, 0, 255), # green
if getattr(roach, serum_name):
return SERUM_OVERLAY_COLORS[serum_name]
return SERUM_OVERLAY_COLORS["none"]
+
+
+class SerumFactory:
+ def __init__(self, suffix):
+ self.suffix = suffix
+
+ def assemble(self, name):
+ assert name in SERUMS
+ puddle = images.load("serum%s/serum" % (self.suffix,))
+ serum_icon = images.load("serum%s/%s" % (
+ self.suffix, SERUM_TILENAME_MAP[name],))
+ frame = puddle.copy()
+ frame.fill(SERUM_OVERLAY_COLORS[name], None, BLEND_RGBA_MULT)
+ frame.blit(serum_icon, (0, 0))
+ return SurfActor(frame)
+
+
+default_serums = SerumFactory("")
+big_serums = SerumFactory("_big")