AI-Project/survival/tile_layer.py

18 lines
557 B
Python
Raw Normal View History

from survival.image import Image
2021-03-14 17:12:11 +01:00
from survival.tile import Tile
class TileLayer:
def __init__(self, width, height):
self.width = width
self.height = height
self.tiles = [[Tile() for x in range(self.width)] for y in range(self.height)]
self.image = Image('atlas.png')
2021-03-14 17:12:11 +01:00
def draw(self, camera):
2021-03-14 17:12:11 +01:00
for y in range(self.height):
for x in range(self.width):
self.image.pos = (x*32, y*32)
self.image.origin = self.tiles[y][x].origin
camera.draw(self.image)