class NPC:
# initalize the NPC
- def __init__ (self, charname, row, col, image=None, portrait=None, dialogue_set=set(),
- 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.dialogue_set = dialogue_set
+ self.dialogues = dialogues
# index of the current dialogue which will be initiated with the main
# character
self.currentdialog = currentdialog
# Bulisa is Butaba's friend
class Bulisa (NPC):
- def __init__ (self, row, col, image, portrait, dialogue_set=set(), currentdialog=0):
- NPC.__init__ (self, "Bulisa", row, col, image, portrait, dialogue_set, 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)
+
+class Mayor (NPC):
+ def __init__ (self, row, col, imageleft, imageright, imagefront,
+ imageback, portrait, position, movement_area=(0,0,0,0),
+ dialogues=[], currentdialog=0):
+ NPC.__init__ (self, "Mayor", row, col, imageleft, imageright, imagefront,
+ imageback, portrait, position, movement_area, 15, dialogues, currentdialog)