def build_invuln(self, palette=None, start=(0, 0, 0), end=(255, 255, 255)):
     """Build range used by the invulnerability powerup."""
     palette = palette or omg.palette.default
     ar, ag, ab = start
     br, bg, bb = end
     for i in range(256):
         bright = sum(palette.colors[i]) // 3
         r = (ar * bright + br * (256 - bright)) // 256
         g = (ag * bright + bg * (256 - bright)) // 256
         b = (ab * bright + bb * (256 - bright)) // 256
         self.tables[32][i] = palette.match((r, g, b))
Beispiel #2
0
 def build_invuln(self, palette=None, start=(0,0,0), end=(255,255,255)):
     """Build range used by the invulnerability powerup."""
     palette = palette or omg.palette.default
     ar, ag, ab = start
     br, bg, bb = end
     for i in range(256):
         bright = sum(palette.colors[i]) // 3
         r = (ar*bright + br*(256-bright)) // 256
         g = (ag*bright + bg*(256-bright)) // 256
         b = (ab*bright + bb*(256-bright)) // 256
         self.tables[32][i] = palette.match((r,g,b))
 def build_fade(self, palette=None, fade=(0, 0, 0)):
     """Build fade tables. The default fade color is black;
     this may be overriden. Light color is not yet supported."""
     palette = palette or omg.palette.default
     x, y, z = fade
     for n in range(32):
         e = 31 - n
         for c in range(256):
             r, g, b = palette.colors[c]
             r = (r * n + x * e) // 32
             g = (g * n + y * e) // 32
             b = (b * n + z * e) // 32
             self.tables[e][c] = palette.match((r, g, b))
Beispiel #4
0
 def build_fade(self, palette=None, fade=(0,0,0)):
     """Build fade tables. The default fade color is black;
     this may be overriden. Light color is not yet supported."""
     palette = palette or omg.palette.default
     x, y, z = fade
     for n in range(32):
         e = 31-n
         for c in range(256):
             r, g, b = palette.colors[c]
             r = (r*n + x*e) // 32
             g = (g*n + y*e) // 32
             b = (b*n + z*e) // 32
             self.tables[e][c] = palette.match((r,g,b))