|
|
@@ -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))
|