+class BulletActor(AnimatedSurfActor):
+ def __init__(self, weapon, **kw):
+ frames = self._shiny_frames(weapon)
+ if frames is None:
+ frames = self._ugly_circle_frames(weapon)
+ super().__init__(frames=frames, **kw)
+ self.weapon = weapon
+
+ def _shiny_frames(self, weapon):
+ if weapon.projectile is None:
+ return None
+ surf = images.load(safepath("projectiles/%s" % (weapon.projectile,)))
+ return [surf]
+
+ def _ugly_circle_frames(self, weapon):
+ radius = min(weapon.damage * 5, 32)
+ surf = Surface((radius * 2, radius * 2))
+ surf.convert_alpha()
+ surf.fill((255, 255, 255, 0))
+ circle(surf, (255, 0, 255, 32), (radius, radius), radius)
+ return [surf]
+
+