Changeset 118:c02a99502a90
- Timestamp:
- 09/02/13 13:44:57 (8 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
nagslang/level.py
r98 r118 129 129 if self._exterior and not force: 130 130 return 131 white = pygame.color.THECOLORS['white'] 132 black = pygame.color.THECOLORS['black'] 131 133 surface = pygame.surface.Surface((self.x, self.y), pgl.SRCALPHA) 132 surface.fill( pygame.color.THECOLORS["black"])134 surface.fill(black) 133 135 for index, polygon in self.polygons.items(): 134 136 if len(polygon) > 1: 135 137 pointlist = [self.point_to_pygame(p) for p in polygon] 136 138 # filled polygons 137 pygame.draw.polygon(surface, pygame.color.THECOLORS['white'], 138 pointlist, 0) 139 color = white 140 # If a polygon overlaps on of the existing polygons, 141 # it is treated as negative 142 # This is not a complete inversion, since any overlap 143 # triggers this (inversion is easy enough, but the 144 # behaviour doesn't seem useful) 145 # We also only check the vertexes - not breaking this 146 # assumption is left to the level designers 147 surface.lock() 148 for p in pointlist: 149 if surface.get_at(p) == white: 150 color = black 151 surface.unlock() 152 pygame.draw.polygon(surface, color, pointlist, 0) 139 153 self._surface.blit(surface, (0, 0), special_flags=pgl.BLEND_RGBA_MULT) 140 154 self._exterior = True
Note:
See TracChangeset
for help on using the changeset viewer.