X-Git-Url: https://harishankar.org/repos/?p=butaba-adventures.git;a=blobdiff_plain;f=npcs.py;fp=npcs.py;h=ae781da196fcc3dd8e01ab20da7a1bd55406ed64;hp=0000000000000000000000000000000000000000;hb=4d50728c1454554fef2ad4841345d0c28101702d;hpb=0b36c3ccd4cb9cdf58fa5285366f023a8c931c61 diff --git a/npcs.py b/npcs.py new file mode 100644 index 0000000..ae781da --- /dev/null +++ b/npcs.py @@ -0,0 +1,34 @@ +# class for Non-Player characters in the game + +import os.path + +# NPC base class + +class NPC: + # initalize the NPC + def __init__ (self, charname, row, col, image=None, portrait=None, dialogue_set=set(), + 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 + # portrait on dialogues + self.portrait = portrait + # dialogue set for NPC + # each dialogue in the set is a path to an XML file containing the dialogue + self.dialogue_set = dialogue_set + # index of the current dialogue which will be initiated with the main + # character + self.currentdialog = currentdialog + # whether the character is dead or alive. If dead no interaction of any + # kind can take place. + self.is_dead = is_dead + +# 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) +