Ignore:
Timestamp:
09/03/13 20:50:29 (8 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Phase:
public
Message:

Interior walls.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/level.py

    r191 r197  
    1717
    1818
     19LINE_COLOR = pygame.color.THECOLORS['orange']
     20
     21
    1922class Level(object):
    2023
     
    2528        self.y = 600
    2629        self.polygons = {}
     30        self.lines = []
    2731        self.basetile = 'tiles/floor.png'
    2832        self._tile_image = None
     
    4650            'base_tile': self.basetile,
    4751            'polygons': self.polygons,
     52            'lines': self.lines,
    4853            'game_objects': self._game_objects,
    4954            'enemies': self._enemies,
     
    5863            for point in points:
    5964                self.polygons[i].append(tuple(point))
     65        self.lines = data.get('lines', [])
    6066        self._game_objects = data.get('game_objects', [])
    6167        for game_object_dict in self._game_objects:
     
    132138
    133139    def get_walls(self):
    134         return self.polygons.values()
     140        walls = self.polygons.values()
     141        walls.extend(self.lines)
     142        return walls
    135143
    136144    def _draw_walls(self):
     
    140148                pointlist = [self.point_to_pygame(p) for p in polygon]
    141149                pygame.draw.lines(self._surface, color, False, pointlist, 2)
     150        for line in self.lines:
     151            pointlist = [self.point_to_pygame(p) for p in line]
     152            pygame.draw.lines(self._surface, LINE_COLOR, False, pointlist, 2)
    142153
    143154    def get_background(self):
Note: See TracChangeset for help on using the changeset viewer.