Changeset 197:34c11bb5c96e


Ignore:
Timestamp:
Sep 3, 2013, 8:50:29 PM (7 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Message:

Interior walls.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • data/levels/level1

    r191 r197  
    5151  - Run around, press some buttons, have fun!
    5252  classname: Note
     53lines:
     54- - [750, 680]
     55  - [950, 680]
     56- - [750, 480]
     57  - [950, 480]
     58- - [750, 480]
     59  - [750, 680]
     60- - [950, 480]
     61  - [950, 680]
    5362polygons:
    5463  1:
  • 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.