X-Git-Url: https://harishankar.org/repos/?p=butaba-adventures.git;a=blobdiff_plain;f=npcs.py;h=26732c23231c9eea3073afabbf662d78df122a81;hp=d3688335e41944f082917d97d52b9262dc88a567;hb=667ea7c15261100aae75b61de8664863b58f01e4;hpb=58f80c37fa3c97f3cfb2a0cdd3096c529f65e204 diff --git a/npcs.py b/npcs.py index d368833..26732c2 100644 --- a/npcs.py +++ b/npcs.py @@ -6,17 +6,37 @@ import os.path class NPC: # initalize the NPC - def __init__ (self, charname, row, col, image=None, portrait=None, dialogues=[], - currentdialog=0, is_dead=False): + def __init__ (self, charname, row, col, imageleft, imageright, imagefront, + imageback, portrait, position, movement_area=(0,0,0,0), movement_speed = 10, + dialogues=[], currentdialog=0, is_dead=False): # name of the character self.charname = charname # row and column to appear (in level) self.row = row self.col = col - # image to represent on level - self.image = image + # initial row and col - to track the movement area + self.initrow = row + self.initcol = col + # images to represent on level + self.imageleft = imageleft + self.imageright = imageright + self.imagefront = imagefront + self.imageback = imageback + # portrait on dialogues self.portrait = portrait + + # movement area limits (left, right top, and bottom) in which the NPC can + # move around in the level randomly. + self.leftlimit, self.rightlimit, self.toplimit, self.bottomlimit = movement_area + + # chance of movement (speed) - that is chance of movement in a turn out of 500 -lower + # the value lower the speed + self.movement_speed = movement_speed + + # position of the character + self.position = position + # dialogue set for NPC # each dialogue in the set is a path to an XML file containing the dialogue self.dialogues = dialogues @@ -29,6 +49,9 @@ class NPC: # Bulisa is Butaba's friend class Bulisa (NPC): - def __init__ (self, row, col, image, portrait, dialogues=[], currentdialog=0): - NPC.__init__ (self, "Bulisa", row, col, image, portrait, dialogues, currentdialog) + def __init__ (self, row, col, imageleft, imageright, imagefront, + imageback, portrait, position, movement_area=(0,0,0,0), + dialogues=[], currentdialog=0): + NPC.__init__ (self, "Bulisa", row, col, imageleft, imageright, imagefront, + imageback, portrait, position, movement_area, 20, dialogues, currentdialog)