Began working on NPC code
[butaba-adventures.git] / npcs.py
diff --git a/npcs.py b/npcs.py
new file mode 100644 (file)
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)
+