diff options
author | raylu <ray.lu@getclever.com> | 2013-10-12 02:27:03 -0700 |
---|---|---|
committer | raylu <ray.lu@getclever.com> | 2013-10-12 03:49:03 -0700 |
commit | b3dcf3217957b0b02e5f367d44dad14b66702ae4 (patch) | |
tree | dc8443017de4849ff7b55799e8bf75a1e00a75ea /tileset.py | |
parent | 312fcdcbf7bf75457c2d56349934c8874fd0b128 (diff) | |
download | troll-b3dcf3217957b0b02e5f367d44dad14b66702ae4.tar.xz |
rename TILESIZE
Diffstat (limited to 'tileset.py')
-rw-r--r-- | tileset.py | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -4,7 +4,7 @@ from xml.etree import ElementTree import pygame class Tileset(object): - tilesize = 16 + TILESIZE = 16 RIGHT = 0 DOWN = 1 LEFT = 2 @@ -23,8 +23,8 @@ class Tileset(object): self.DOWN: pygame.transform.rotate(image, 270), } self.tile_width, self.tile_height = image.get_size() - self.tile_width /= self.tilesize - self.tile_height /= self.tilesize + self.tile_width /= self.TILESIZE + self.tile_height /= self.TILESIZE def _render(self, tile_x, tile_y, pos, direction=RIGHT): tileset = self.tileset[direction] @@ -36,9 +36,9 @@ class Tileset(object): x, y = self.tile_width - tile_x - 1, self.tile_height - tile_y - 1 elif direction == self.DOWN: x, y = self.tile_height -tile_y - 1, tile_x - x *= self.tilesize - y *= self.tilesize - self.screen.blit(tileset, pos, (x, y, self.tilesize, self.tilesize)) + x *= self.TILESIZE + y *= self.TILESIZE + self.screen.blit(tileset, pos, (x, y, self.TILESIZE, self.TILESIZE)) def render_person(self, pos, direction): self._render(0, 13, pos, direction) @@ -73,7 +73,7 @@ class Tileset(object): def render_level(self): for i, tile in enumerate(self.level_array): y, x = divmod(i, 50) - x *= self.tilesize - y *= self.tilesize - tile_y, tile_x = divmod(tile - 1, self.tilesize) # those 1-indexing fuckers + x *= self.TILESIZE + y *= self.TILESIZE + tile_y, tile_x = divmod(tile - 1, self.TILESIZE) # those 1-indexing fuckers self._render(tile_x, tile_y, (x, y)) |