1 """ Tools for creating serum actors. """
3 from pgzero.loaders import images
4 from pygame.constants import BLEND_RGBA_MULT
5 from .actors.surf import SurfActor
7 SERUMS = ["smart", "fast", "strong"]
10 "smart": "intelligence",
15 SERUM_OVERLAY_COLORS = {
16 "smart": (0, 0, 255, 255), # blue
17 "fast": (0, 255, 0, 255), # green
18 "strong": (255, 0, 255, 255), # purple
19 "none": (170, 68, 0, 255), # brown
23 def roach_serum_color(roach):
24 for serum_name in SERUMS:
25 if getattr(roach, serum_name):
26 return SERUM_OVERLAY_COLORS[serum_name]
27 return SERUM_OVERLAY_COLORS["none"]
30 def roach_is_serumless(roach):
31 for serum_name in SERUMS:
32 if getattr(roach, serum_name):
38 def __init__(self, suffix):
41 def assemble(self, name):
43 puddle = images.load("serum%s/serum" % (self.suffix,))
44 serum_icon = images.load("serum%s/%s" % (
45 self.suffix, SERUM_TILENAME_MAP[name],))
47 frame.fill(SERUM_OVERLAY_COLORS[name], None, BLEND_RGBA_MULT)
48 frame.blit(serum_icon, (0, 0))
49 return SurfActor(frame)
52 default_serums = SerumFactory("")
53 big_serums = SerumFactory("_big")