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"]
31 def __init__(self, suffix):
34 def assemble(self, name):
36 puddle = images.load("serum%s/serum" % (self.suffix,))
37 serum_icon = images.load("serum%s/%s" % (
38 self.suffix, SERUM_TILENAME_MAP[name],))
40 frame.fill(SERUM_OVERLAY_COLORS[name], None, BLEND_RGBA_MULT)
41 frame.blit(serum_icon, (0, 0))
42 return SurfActor(frame)
45 default_serums = SerumFactory("")
46 big_serums = SerumFactory("_big")