X-Git-Url: https://harishankar.org/repos/?p=butaba-adventures.git;a=blobdiff_plain;f=level.py;h=de8d76fed3e40daeaf64c9d71309288d204bc39c;hp=04bc6cd4ffa7f1fb35eff25cfee825a1bbadb906;hb=4d50728c1454554fef2ad4841345d0c28101702d;hpb=4b6e952b476861c8979dc395781964099285a4c6 diff --git a/level.py b/level.py index 04bc6cd..de8d76f 100644 --- a/level.py +++ b/level.py @@ -10,41 +10,11 @@ import object # second item is tile col in the tilest # third item defines whether solid or not (0 or 1) -# constants for in-game use -KEY_CHEST1 = 1000 -KEY_ROOM1 = 1001 - -# start level background data -LEVEL_1 = [ - [ (0, 0, 0), (1, 0, 0), (0, 5, 1), (0, 6, 1), (1, 0, 0), (0, 0, 0), (1, 0, 0), (1, 0, 0), (2, 0, 1), (1, 0, 0) ], - [ (0, 0, 0), (0, 0, 0), (1, 5, 1), (1, 6, 1), (0, 0, 0), (3, 8, 1), (0, 7, 1), (0, 7, 1), (0, 7, 1), (0, 7, 1) ], - [ (0, 0, 0), (0, 0, 0), (0, 0, 0), (2, 0, 1), (1, 0, 0), (0, 8, 1), (3,10, 0), (3,10, 0), (3,10, 0), (3,10, 0) ], - [ (0, 0, 0), (1, 0, 0), (0, 0, 0), (2, 0, 1), (0, 0, 0), (1, 9, 1), (3,10, 0), (3,10, 0), (3,10, 0), (3,10, 0) ], - [ (4, 5, 0), (4, 5, 0), (4, 5, 0), (4, 5, 0), (4, 5, 0), (3,10, 0), (3,10, 0), (3,10, 0), (3,10, 0), (3,10, 0) ], - [ (5, 5, 0), (5, 5, 0), (5, 5, 0), (5, 5, 0), (5, 5, 0), (3,10, 0), (3,10, 0), (3,10, 0), (3,10, 0), (3,10, 0) ], - [ (0, 0, 0), (0, 0, 0), (0, 0, 0), (2, 0, 1), (1, 0, 0), (0, 9, 1), (3,10, 0), (3,10, 0), (3,10, 0), (3,10, 0) ], - [ (0, 0, 0), (0, 0, 0), (0, 0, 0), (2, 0, 1), (1, 0, 0), (1,11, 1), (3,10, 0), (3,10, 0), (3,10, 0), (3,10, 0) ], - [ (0, 0, 0), (0, 0, 0), (0, 5, 1), (0, 6, 1), (0, 0, 0), (0,10, 1), (0, 7, 1), (0, 7, 1), (1,10, 1), (0, 7, 1) ], - [ (1, 0, 0), (0, 0, 0), (1, 5, 1), (1, 6, 1), (1, 0, 0), (0, 0, 0), (0, 0, 0), (1, 0, 0), (2, 0, 1), (1, 0, 0) ] -] - -# level to the east of start level background data -LEVEL_1E = [ - [ (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (1, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0) ], - [ (0, 7, 1), (0, 7, 1), (0, 7, 1), (0, 7, 1), (0, 7, 1), (0, 7, 1), (3, 9, 1), (0, 0, 0), (0, 0, 0), (2, 0, 0) ], - [ (3,10, 0), (3,10, 0), (3,10, 0), (3,10, 0), (3,10, 0), (3,10, 0), (0, 8, 1), (0, 0, 0), (0, 0, 0), (0, 0, 0) ], - [ (3,10, 0), (0, 9, 1), (3,10, 0), (3,10, 0), (3,10, 0), (3,10, 0), (0, 8, 1), (0, 0, 0), (3, 6, 0), (3, 5, 0) ], - [ (3,10, 0), (0, 8, 1), (3,10, 0), (3,10, 0), (3,10, 0), (3,10, 0), (0, 8, 1), (0, 0, 0), (3, 5, 0), (3, 6, 0) ], - [ (3,10, 0), (0, 8, 1), (3,10, 0), (3,10, 0), (3,10, 0), (3,10, 0), (0, 8, 1), (0, 0, 0), (3, 6, 0), (3, 5, 0) ], - [ (3,10, 0), (0, 8, 1), (3,10, 0), (3,10, 0), (3,10, 0), (3,10, 0), (0, 8, 1), (0, 0, 0), (3, 5, 0), (3, 6, 0) ], - [ (3,10, 0), (0, 8, 1), (3,10, 0), (3,10, 0), (3,10, 0), (3,10, 0), (0, 8, 1), (0, 0, 0), (0, 0, 0), (0, 0, 0) ], - [ (0, 7, 1), (3 ,7, 1), (0, 7, 1), (0, 7, 1), (0, 7, 1), (1,10, 1), (0,11, 1), (0, 0, 0), (0, 0, 0), (2, 0, 0) ], - [ (0, 0, 0), (0, 0, 0), (1, 0, 0), (3, 4, 0), (0, 0, 0), (0, 0, 0), (1, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0) ] -] # Class to represent levels class Level: - def __init__ (self, bgdata, levelleft=None, levelright=None, leveltop = None, levelbottom = None, objects=[]): + def __init__ (self, bgdata, levelleft=None, levelright=None, + leveltop = None, levelbottom = None, objects=[], npcs=[]): self.background = bgdata # portals for level above, below, left or right of the character self.levelleft = levelleft @@ -54,3 +24,6 @@ class Level: # objects in the level as a list self.objects = objects + + # npcs in the level as a list + self.npcs = npcs