Started work on NPC dialogues
[butaba-adventures.git] / maingame.py
index 431d44d..32df4cc 100644 (file)
@@ -28,6 +28,9 @@ class MainGame:
 
                self.img_chestbg = pygame.image.load (os.path.join ("background", "chestcontent.png")).convert ()
 
+               self.img_dialogue = pygame.image.load (os.path.join ("background", "dialog_screen.png")).convert ()
+               self.img_dialogue.set_colorkey (pygame.Color (0, 255, 0))
+
 
                # initialize object graphics
                self.img_redpotion = pygame.image.load (os.path.join ("objects", "red-potion.png")).convert ()
@@ -61,6 +64,9 @@ class MainGame:
                self.img_bulisa = pygame.image.load (os.path.join ("sprite", "bulisa.png")).convert ()
                self.img_bulisa.set_colorkey (pygame.Color (0, 255, 0))
 
+               # initialize NPC portraits
+               self.img_bulisa_portrait = pygame.image.load (os.path.join ("portraits", "bulisa.png")).convert ()
+
                # set level data
                self.setup_levels ()
                # set current level and position of our character
@@ -85,7 +91,8 @@ class MainGame:
                potion2 = gameobjects.HealthPotion (5, 2, self.img_redpotion)
                potion3 = gameobjects.HealthPotion (5, 2, self.img_redpotion)
 
-               npc_bulisa = npcs.Bulisa (4, 3, self.img_bulisa, None)
+               npc_bulisa = npcs.Bulisa (4, 3, self.img_bulisa, self.img_bulisa_portrait,
+                                                                               [ os.path.join ("dialogues", "bulisa1.dlg") ])
 
                chest1.objects = [ gold50, gold25, potion2, potion3, key2, gold10 ]
 
@@ -247,7 +254,12 @@ class MainGame:
 
        # interaction with npcs
        def interact_npc (self, npc):
-               pass
+               # interact with NPC and get the response ID
+               resp_id = utility.dialogue_play (self.screen, self.img_dialogue, npc, self.butaba, 0, 90)
+
+               # if none
+               if resp_id is None:
+                       self.status_message = "You cannot initiate a conversation with %s" % npc.charname
 
        # interaction with objects
        def interact_objects (self, container, objs):