annotate nagslang/level.py @ 98:93256a0987a2

Fix newer pep8 continuation complaint
author Neil Muller <drnlmuller@gmail.com>
date Mon, 02 Sep 2013 11:50:04 +0200
parents ecba9550ad8d
children c02a99502a90
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
50
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
1 import pygame
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
2 import pygame.locals as pgl
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
3
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
4 from nagslang.resources import resources
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
5
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
6 POLY_COLORS = {
53
39d346467052 Draw all the walls.
Simon Cross <hodgestar@gmail.com>
parents: 50
diff changeset
7 1: pygame.color.THECOLORS['red'],
39d346467052 Draw all the walls.
Simon Cross <hodgestar@gmail.com>
parents: 50
diff changeset
8 2: pygame.color.THECOLORS['green'],
39d346467052 Draw all the walls.
Simon Cross <hodgestar@gmail.com>
parents: 50
diff changeset
9 3: pygame.color.THECOLORS['yellow'],
39d346467052 Draw all the walls.
Simon Cross <hodgestar@gmail.com>
parents: 50
diff changeset
10 4: pygame.color.THECOLORS['blue'],
39d346467052 Draw all the walls.
Simon Cross <hodgestar@gmail.com>
parents: 50
diff changeset
11 5: pygame.color.THECOLORS['lightblue'],
39d346467052 Draw all the walls.
Simon Cross <hodgestar@gmail.com>
parents: 50
diff changeset
12 6: pygame.color.THECOLORS['magenta'],
39d346467052 Draw all the walls.
Simon Cross <hodgestar@gmail.com>
parents: 50
diff changeset
13 }
50
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
14
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
15
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
16 class Level(object):
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
17
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
18 def __init__(self, name):
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
19 self.name = name
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
20 # defaults
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
21 self.x = 800
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
22 self.y = 600
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
23 self.polygons = {}
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
24 self.basetile = 'tiles/floor.png'
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
25 self._tile_image = None
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
26 self._surface = None
95
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
27 self._exterior = False
50
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
28
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
29 def load(self):
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
30
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
31 def add_polygon(polygon, index, num_points):
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
32 self.polygons[index] = polygon
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
33 if len(polygon) != num_points:
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
34 print 'Error - incorrect polygon size'
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
35 print 'Expected: %d, got %d' % (num_points, len(polygon))
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
36
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
37 inpoly = False
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
38 polygon = []
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
39 index = 0
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
40 num_points = 0
75
79748a884eb5 Put levels in a levels directory
Stefano Rivera <stefano@rivera.za.net>
parents: 72
diff changeset
41 with resources.get_file('levels', self.name) as f:
50
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
42 for line in f:
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
43 if inpoly:
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
44 if not line.startswith('Point:'):
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
45 add_polygon(polygon, index, num_points)
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
46 polygon = []
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
47 inpoly = False
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
48 index = 0
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
49 else:
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
50 point = line.split(':', 1)[1]
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
51 x, y = [int(i) for i in point.split()]
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
52 polygon.append((x, y))
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
53 if line.startswith('X-Size:'):
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
54 self.x = int(line.split(':', 1)[1])
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
55 elif line.startswith('Y-Size:'):
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
56 self.y = int(line.split(':', 1)[1])
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
57 elif line.startswith('Base tile:'):
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
58 self.basetile = line.split(':', 1)[1].strip()
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
59 elif line.startswith('Polygon'):
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
60 rest = line.split(' ', 1)[1]
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
61 index, num_points = [int(x) for x in rest.split(':', 1)]
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
62 inpoly = True
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
63 if index:
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
64 add_polygon(polygon, index, num_points)
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
65
95
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
66 def all_closed(self):
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
67 """Check if all the polygons are closed"""
72
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
68 closed = True
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
69 for poly in self.polygons.values():
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
70 if len(poly) == 0:
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
71 # We ignore empty polygons
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
72 continue
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
73 elif len(poly) == 1:
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
74 closed = False
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
75 print "\033[31mError: polygon too small\033[0m"
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
76 elif poly[-1] != poly[0]:
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
77 closed = False
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
78 print "\033[31mError: polygon not closed\033[0m"
95
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
79 return closed
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
80
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
81 def save(self):
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
82 closed = self.all_closed()
72
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
83 if not closed:
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
84 print 'Not saving the level'
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
85 return
75
79748a884eb5 Put levels in a levels directory
Stefano Rivera <stefano@rivera.za.net>
parents: 72
diff changeset
86 with resources.get_file('levels', self.name, mode='w') as f:
72
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
87 f.write('X-Size: %s\n' % self.x)
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
88 f.write('Y-Size: %s\n' % self.y)
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
89 f.write('Base tile: %s\n' % self.basetile)
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
90 for i, poly in self.polygons.items():
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
91 if len(poly) == 0:
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
92 continue
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
93 f.write('Polygon %d : %d\n' % (i, len(poly)))
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
94 for point in poly:
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
95 f.write('Point: %d %d\n' % point)
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
96 print 'level %s saved' % self.name
5db052531510 Move save() to Level
Stefano Rivera <stefano@rivera.za.net>
parents: 54
diff changeset
97
50
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
98 def get_size(self):
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
99 return self.x, self.y
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
100
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
101 def set_base_tile(self, new_tile):
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
102 self.basetile = new_tile
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
103 self._tile_image = None
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
104
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
105 def point_to_pygame(self, pos):
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
106 # Convert a point from pymunk (which is what we store)
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
107 # to pygame for drawing
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
108 return (pos[0], self.y - pos[1])
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
109
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
110 def get_walls(self):
53
39d346467052 Draw all the walls.
Simon Cross <hodgestar@gmail.com>
parents: 50
diff changeset
111 return self.polygons.values()
50
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
112
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
113 def _draw_walls(self):
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
114 for index, polygon in self.polygons.items():
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
115 color = POLY_COLORS[index]
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
116 if len(polygon) > 1:
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
117 pointlist = [self.point_to_pygame(p) for p in polygon]
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
118 pygame.draw.lines(self._surface, color, False, pointlist, 2)
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
119
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
120 def get_background(self):
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
121 self._draw_background()
95
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
122 self._draw_exterior()
50
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
123 # Draw polygons
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
124 self._draw_walls()
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
125 return self._surface
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
126
95
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
127 def _draw_exterior(self, force=False):
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
128 """Fill the exterior of the level with black"""
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
129 if self._exterior and not force:
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
130 return
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
131 surface = pygame.surface.Surface((self.x, self.y), pgl.SRCALPHA)
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
132 surface.fill(pygame.color.THECOLORS["black"])
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
133 for index, polygon in self.polygons.items():
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
134 if len(polygon) > 1:
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
135 pointlist = [self.point_to_pygame(p) for p in polygon]
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
136 # filled polygons
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
137 pygame.draw.polygon(surface, pygame.color.THECOLORS['white'],
98
93256a0987a2 Fix newer pep8 continuation complaint
Neil Muller <drnlmuller@gmail.com>
parents: 95
diff changeset
138 pointlist, 0)
95
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
139 self._surface.blit(surface, (0, 0), special_flags=pgl.BLEND_RGBA_MULT)
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
140 self._exterior = True
ecba9550ad8d Fill the exterior with the blackness of space
Neil Muller <drnlmuller@gmail.com>
parents: 75
diff changeset
141
50
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
142 def _draw_background(self, force=False):
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
143 if self._tile_image is None:
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
144 self._tile_image = resources.get_image(self.basetile)
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
145 if self._surface is not None and not force:
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
146 # We assume we don't change
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
147 return self._surface
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
148 self._surface = pygame.surface.Surface((self.x, self.y), pgl.SRCALPHA)
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
149 self._surface.fill(pygame.color.THECOLORS['black'])
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
150 x_step = self._tile_image.get_rect().width
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
151 y_step = self._tile_image.get_rect().height
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
152 x_count = self.x // x_step + 1
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
153 y_count = self.y / y_step + 1
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
154 for x in range(x_count):
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
155 for y in range(y_count):
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
156 tile_rect = pygame.rect.Rect(x * x_step, y * y_step,
98
93256a0987a2 Fix newer pep8 continuation complaint
Neil Muller <drnlmuller@gmail.com>
parents: 95
diff changeset
157 x_step, y_step)
50
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
158 self._surface.blit(self._tile_image, tile_rect)
94d47bfcc7bb Approximate levels and walls
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
159 return self._surface