From 99bccc33422efc7e30588087e724ead3a7de7715 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 5 Mar 2016 12:49:14 +0200 Subject: [PATCH] Show the grate --- koperkapel/gamelib/tiles.py | 4 ++++ koperkapel/loaders/levelloader.py | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/koperkapel/gamelib/tiles.py b/koperkapel/gamelib/tiles.py index 66a74ff..fd47252 100644 --- a/koperkapel/gamelib/tiles.py +++ b/koperkapel/gamelib/tiles.py @@ -60,6 +60,10 @@ class Wall(RandomizedTile): class Underground(RandomizedTile): IMGDIR = "underground" +class Grate(Tile): + IMG = os.path.join('grate', 'grate') + TILESET = 'bunker' + class Tunnel(OrientatedTile): @classmethod diff --git a/koperkapel/loaders/levelloader.py b/koperkapel/loaders/levelloader.py index 4bc24db..0addecc 100644 --- a/koperkapel/loaders/levelloader.py +++ b/koperkapel/loaders/levelloader.py @@ -4,7 +4,7 @@ import json from pgzero.loaders import ResourceLoader -from ..gamelib.tiles import Wall, Floor, Tunnel, Underground +from ..gamelib.tiles import Wall, Floor, Tunnel, Underground, Grate from ..gamelib.level import Level @@ -51,6 +51,10 @@ class LevelLoader(ResourceLoader): neighbors = [x[layer] if x else None for x in neighborhood] tile['%s image' % layer] = \ TILES[tile[layer]['base']].image(neighbors) + # Hack this for now + if layer == 'floor' and 'crawl' in tile[layer]['behaviour']: + print('Here') + tile['floor image'] = Grate.image(neighbors) levels = LevelLoader('levels') -- 2.34.1