32 lines
850 B
Python
32 lines
850 B
Python
from gamedata.objects.base import BaseObject
|
|
|
|
class TilesetRenderer(BaseObject):
|
|
|
|
def __init__(self,x,y,game):
|
|
|
|
super().__init__(x,y,game)
|
|
|
|
self.tilew = 64
|
|
self.tileh = 64
|
|
|
|
self.solid = game.sprite_lib["solid.png"]
|
|
self.empty = game.sprite_lib["empty.png"]
|
|
|
|
self.collisiongrid = [
|
|
[0,0,0,0,0,0,0],
|
|
[1,0,0,0,1,0,0],
|
|
[1,1,0,0,0,0,0],
|
|
[1,1,0,0,0,0,0],
|
|
[1,1,0,1,0,1,1],
|
|
[1,1,0,1,1,1,0],
|
|
]
|
|
|
|
def draw(self):
|
|
|
|
for y in range(len(self.collisiongrid)):
|
|
for x in range(len(self.collisiongrid[y])):
|
|
|
|
data = self.collisiongrid[y][x]
|
|
sprites = [self.empty,self.solid]
|
|
self.game.window.blit(sprites[data],(self.rect[0]+x*self.tilew,self.rect[1]+y*self.tileh))
|