Changeset 425:1a85044f81a8 for nagslang


Ignore:
Timestamp:
Sep 7, 2013, 11:34:01 AM (7 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
Children:
426:275e0b4bd571, 428:6bbb0ac87acc
Message:

Safer color access

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/level.py

    r408 r425  
    1919    5: pygame.color.THECOLORS['lightblue'],
    2020    6: pygame.color.THECOLORS['magenta'],
     21    7: pygame.color.THECOLORS['lightgreen'],
     22    8: pygame.color.THECOLORS['grey'],
    2123}
    2224
     
    186188    def _draw_walls(self):
    187189        for index, polygon in self.polygons.items():
    188             color = POLY_COLORS[index]
     190            color = POLY_COLORS.get(index, pygame.color.THECOLORS['black'])
    189191            if len(polygon) > 1:
    190192                pointlist = [self.point_to_pygame(p) for p in polygon]
Note: See TracChangeset for help on using the changeset viewer.