Show the grate
authorNeil <neil@dip.sun.ac.za>
Sat, 5 Mar 2016 10:49:14 +0000 (12:49 +0200)
committerNeil <neil@dip.sun.ac.za>
Sat, 5 Mar 2016 10:49:21 +0000 (12:49 +0200)
koperkapel/gamelib/tiles.py
koperkapel/loaders/levelloader.py

index 66a74ff05eee0cf6c6aee259f041762e7d31b94a..fd47252b5cb861513a643d23a35666684266f56d 100644 (file)
@@ -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
index 4bc24db683502361317ff4c0b697f6ad603af6f1..0addeccf5c54d678dadbaa8d796e904e26ebf01e 100644 (file)
@@ -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')