Continuing work on context-sensitive dialogs
authorHarishankar <v.harishankar@gmail.com>
Thu, 6 Oct 2011 14:51:50 +0000 (20:21 +0530)
committerHarishankar <v.harishankar@gmail.com>
Thu, 6 Oct 2011 14:51:50 +0000 (20:21 +0530)
More work completed on context sensitive dialogs. Added more
objects and interaction like well and bucket to draw water
with. A basic "mission mode" is now possible with the help
of game state variables, context sensitive dialogues and
object interactions. More to follow

background/tileset.png
constants.py
dialogues/bulisa2.dlg
dialogues/bulisa4.dlg [new file with mode: 0644]
gameobjects.py
level1ee.dat [new file with mode: 0644]
levels/level1ee.dat [new file with mode: 0644]
levels/level1n.dat [new file with mode: 0644]
maingame.py
objects/bucket.png [new file with mode: 0644]

index 7b8d16a..a7f28f7 100644 (file)
Binary files a/background/tileset.png and b/background/tileset.png differ
index bc9e737..18111c6 100644 (file)
@@ -8,4 +8,7 @@ KEY_CHEST2 = 1001
 # maximum experience points reached by achieving certain actions
 
 # maximum knowledge to be gained by unlocking chests
-KNOWLEDGEMAX_CHEST_UNLOCK = 2
\ No newline at end of file
+KNOWLEDGEMAX_CHEST_UNLOCK = 2
+
+# maximum strength to be gained by draw water from well
+STRENGTHMAX_DRAW_WELL_WATER = 3
\ No newline at end of file
index 9af9209..bb504e1 100644 (file)
@@ -2,6 +2,16 @@
 <conversation>
   <dialogue id="1">
     <speech>Hello, my friend. I see you've not yet brought back water from the well.</speech> 
+    <response id="13.1" nextdialogue="2">Where can I find a bucket?</response>
+    <response id="13.2" nextdialogue="3">Where can I find the well?</response>
     <response id="14" nextdialogue="0">I'll go and get it at once!</response>
   </dialogue>
+  <dialogue id="2">
+    <speech>Didn't you hear? You can find the bucket somewhere in the garden.</speech>
+    <response id="13.3" nextdialogue="0">Thanks...</response>
+  </dialogue>
+  <dialogue id="3">
+    <speech>I already told you, there is a well behind the house!</speech>
+    <response id="13.4" nextdialogue="0">Uh, thanks!</response>
+  </dialogue>
 </conversation>
\ No newline at end of file
diff --git a/dialogues/bulisa4.dlg b/dialogues/bulisa4.dlg
new file mode 100644 (file)
index 0000000..2674783
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<conversation>
+  <dialogue id="1">
+    <speech>Ah, I see you're back with the water! Thanks so much, Butaba.</speech>
+    <response id="19" nextdialogue="0">No problem! My pleasure...</response>
+  </dialogue>
+</conversation>
\ No newline at end of file
index 2edbc5b..c9c945b 100644 (file)
@@ -22,6 +22,45 @@ class GameObject:
        def use (self, otherobject):
                pass
 
+# class for well
+class Well (GameObject):
+       def __init__ (self, row, col, image=None, liquid = "water"):
+               self.liquid = liquid
+               text = "Well"
+               GameObject.__init__ (self, row, col, text, image, False, "Draw %s" % liquid)
+
+       def interact (self):
+               return False
+
+       def use (self, otherobject):
+               # if the object is a bucket, fill it
+               if isinstance (otherobject, Bucket) is True:
+                       # but only if it is empty
+                       if otherobject.liquid is None:
+                               otherobject.liquid = self.liquid
+
+
+# class for buckets
+class Bucket (GameObject):
+       def __init__ (self, row, col, image=None, liquid = None):
+               self.liquid = liquid
+               text = "Bucket"
+               if liquid is not None:
+                       text = text + " containing %s" % liquid
+               GameObject.__init__ (self, row, col, text, image, True, "Empty it")
+
+       def interact (self):
+               return True
+
+       def use (self, otherobject):
+               # if the other object is a bucket, transfer its
+               # contents to the other bucket
+               if isinstance (otherobject, Bucket):
+                       otherobject.liquid = self.liquid
+               # empty the bucket of its contents
+               self.liquid = None
+               self.text = "Bucket"
+
 class GoldCoins (GameObject):
        # initialize
        def __init__ (self, row, col, image, value):
diff --git a/level1ee.dat b/level1ee.dat
new file mode 100644 (file)
index 0000000..af732bc
--- /dev/null
@@ -0,0 +1,412 @@
+(lp1
+(lp2
+(lp3
+I0
+aI0
+aI0
+aa(lp4
+I0
+aI0
+aI0
+aa(lp5
+I0
+aI0
+aI0
+aa(lp6
+I0
+aI0
+aI0
+aa(lp7
+I0
+aI0
+aI0
+aa(lp8
+I0
+aI0
+aI0
+aa(lp9
+I0
+aI0
+aI0
+aa(lp10
+I2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
+aI0
+aa(lp110
+I3
+aI4
+aI0
+aa(lp111
+I1
+aI1
+aI0
+aaa.
\ No newline at end of file
diff --git a/levels/level1ee.dat b/levels/level1ee.dat
new file mode 100644 (file)
index 0000000..f449775
--- /dev/null
@@ -0,0 +1,412 @@
+(lp1
+(lp2
+(lp3
+I0
+aI1
+aI0
+aa(lp4
+I0
+aI4
+aI0
+aa(lp5
+I0
+aI0
+aI0
+aa(lp6
+I0
+aI0
+aI0
+aa(lp7
+I0
+aI0
+aI0
+aa(lp8
+I3
+aI4
+aI0
+aa(lp9
+I0
+aI0
+aI0
+aa(lp10
+I0
+aI0
+aI0
+aa(lp11
+I2
+aI11
+aI01
+aa(lp12
+I0
+aI0
+aI0
+aaa(lp13
+(lp14
+I2
+aI1
+aI0
+aa(lp15
+I2
+aI4
+aI0
+aa(lp16
+I0
+aI0
+aI0
+aa(lp17
+I2
+aI0
+aI01
+aa(lp18
+I0
+aI0
+aI0
+aa(lp19
+I0
+aI0
+aI0
+aa(lp20
+I0
+aI0
+aI0
+aa(lp21
+I2
+aI0
+aI01
+aa(lp22
+I2
+aI10
+aI01
+aa(lp23
+I0
+aI0
+aI0
+aaa(lp24
+(lp25
+I3
+aI5
+aI0
+aa(lp26
+I0
+aI0
+aI0
+aa(lp27
+I0
+aI0
+aI0
+aa(lp28
+I0
+aI0
+aI0
+aa(lp29
+I0
+aI0
+aI0
+aa(lp30
+I0
+aI0
+aI0
+aa(lp31
+I0
+aI0
+aI0
+aa(lp32
+I0
+aI0
+aI0
+aa(lp33
+I2
+aI10
+aI01
+aa(lp34
+I2
+aI10
+aI01
+aaa(lp35
+(lp36
+I3
+aI5
+aI0
+aa(lp37
+I3
+aI6
+aI0
+aa(lp38
+I0
+aI0
+aI0
+aa(lp39
+I0
+aI0
+aI0
+aa(lp40
+I0
+aI0
+aI0
+aa(lp41
+I2
+aI0
+aI01
+aa(lp42
+I0
+aI0
+aI0
+aa(lp43
+I0
+aI0
+aI0
+aa(lp44
+I2
+aI5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0
+aI0
+aa(lp95
+I0
+aI0
+aI0
+aa(lp96
+I0
+aI0
+aI0
+aa(lp97
+I2
+aI0
+aI01
+aa(lp98
+I0
+aI0
+aI0
+aa(lp99
+I2
+aI10
+aI01
+aa(lp100
+I0
+aI0
+aI0
+aaa(lp101
+(lp102
+I0
+aI0
+aI0
+aa(lp103
+I0
+aI0
+aI0
+aa(lp104
+I0
+aI0
+aI0
+aa(lp105
+I0
+aI0
+aI0
+aa(lp106
+I0
+aI0
+aI0
+aa(lp107
+I0
+aI0
+aI0
+aa(lp108
+I3
+aI4
+aI0
+aa(lp109
+I0
+aI0
+aI0
+aa(lp110
+I2
+aI10
+aI01
+aa(lp111
+I0
+aI0
+aI0
+aaa.
\ No newline at end of file
diff --git a/levels/level1n.dat b/levels/level1n.dat
new file mode 100644 (file)
index 0000000..8bc5e25
--- /dev/null
@@ -0,0 +1,412 @@
+(lp1
+(lp2
+(lp3
+I2
+aI1
+aI0
+aa(lp4
+I2
+aI2
+aI0
+aa(lp5
+I2
+aI2
+aI0
+aa(lp6
+I2
+aI3
+aI0
+aa(lp7
+I2
+aI3
+aI0
+aa(lp8
+I2
+aI3
+aI0
+aa(lp9
+I2
+aI4
+aI0
+aa(lp10
+I0
+aI0
+aI0
+aa(lp11
+I2
+aI1
+aI0
+aa(lp12
+I2
+aI2
+aI0
+aaa(lp13
+(lp14
+I2
+aI10
+aI01
+aa(lp15
+I2
+aI10
+aI01
+aa(lp16
+I2
+aI10
+aI01
+aa(lp17
+I2
+aI11
+aI01
+aa(lp18
+I2
+aI10
+aI01
+aa(lp19
+I2
+aI10
+aI01
+aa(lp20
+I2
+aI10
+aI01
+aa(lp21
+I2
+aI10
+aI01
+aa(lp22
+I2
+aI10
+aI01
+aa(lp23
+I2
+aI10
+aI01
+aaa(lp24
+(lp25
+I0
+aI0
+aI0
+aa(lp26
+I0
+aI0
+aI0
+aa(lp27
+I3
+aI4
+aI0
+aa(lp28
+I0
+aI0
+aI0
+aa(lp29
+I2
+a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0
+aaa(lp79
+(lp80
+I0
+aI0
+aI0
+aa(lp81
+I2
+aI0
+aI01
+aa(lp82
+I0
+aI0
+aI0
+aa(lp83
+I0
+aI0
+aI0
+aa(lp84
+I0
+aI0
+aI0
+aa(lp85
+I0
+aI0
+aI0
+aa(lp86
+I0
+aI0
+aI0
+aa(lp87
+I2
+aI0
+aI01
+aa(lp88
+I0
+aI0
+aI0
+aa(lp89
+I0
+aI0
+aI0
+aaa(lp90
+(lp91
+I0
+aI0
+aI0
+aa(lp92
+I0
+aI0
+aI0
+aa(lp93
+I0
+aI0
+aI0
+aa(lp94
+I2
+aI0
+aI01
+aa(lp95
+I0
+aI0
+aI0
+aa(lp96
+I0
+aI0
+aI0
+aa(lp97
+I0
+aI0
+aI0
+aa(lp98
+I0
+aI0
+aI0
+aa(lp99
+I0
+aI0
+aI0
+aa(lp100
+I2
+aI0
+aI01
+aaa(lp101
+(lp102
+I0
+aI0
+aI0
+aa(lp103
+I0
+aI0
+aI0
+aa(lp104
+I0
+aI0
+aI0
+aa(lp105
+I0
+aI0
+aI0
+aa(lp106
+I0
+aI0
+aI0
+aa(lp107
+I0
+aI0
+aI0
+aa(lp108
+I0
+aI0
+aI0
+aa(lp109
+I0
+aI0
+aI0
+aa(lp110
+I0
+aI0
+aI0
+aa(lp111
+I0
+aI0
+aI0
+aaa.
\ No newline at end of file
index 66f28b8..9ba5ea2 100644 (file)
@@ -50,6 +50,8 @@ class MainGame:
                self.img_key2.set_colorkey (pygame.Color (0, 255, 0))
                self.img_chest = pygame.image.load (os.path.join ("objects", "chest.png")).convert ()
                self.img_chest.set_colorkey (pygame.Color (0, 255, 0))
+               self.img_bucket = pygame.image.load (os.path.join ("objects", "bucket.png")).convert ()
+               self.img_bucket.set_colorkey (pygame.Color (0, 255, 0))
 
                # initialize player graphics
                self.img_butabafront = pygame.image.load (os.path.join ("sprite", "butaba-front.png")).convert ()
@@ -90,30 +92,45 @@ class MainGame:
                gold50 = gameobjects.GoldCoins (6, 2, self.img_goldcoins, 50)
                gold25 = gameobjects.GoldCoins (6, 2, self.img_goldcoins, 25)
                gold10 = gameobjects.GoldCoins (6, 2, self.img_goldcoins, 10)
-               potion2 = gameobjects.HealthPotion (5, 2, self.img_redpotion)
-               potion3 = gameobjects.HealthPotion (5, 2, self.img_redpotion)
+               bucket = gameobjects.Bucket (6, 3, self.img_bucket)
+
+               well1 = gameobjects.Well (4, 7)
+               well2 = gameobjects.Well (5, 7)
+               well3 = gameobjects.Well (4, 8)
+               well4 = gameobjects.Well (5, 8)
 
                npc_bulisa = npcs.Bulisa (4, 3, self.img_bulisa, self.img_bulisa_portrait,
                                                                                [ os.path.join ("dialogues", "bulisa1.dlg"),
                                                                                  os.path.join ("dialogues", "bulisa2.dlg"),
-                                                                                 os.path.join ("dialogues", "bulisa3.dlg") ] )
+                                                                                 os.path.join ("dialogues", "bulisa3.dlg"),
+                                                                                 os.path.join ("dialogues", "bulisa4.dlg") ] )
 
-               chest1.objects = [ gold50, gold25, potion2, potion3, key2, gold10 ]
+               chest1.objects = [ gold50, gold25, key2, gold10 ]
 
                # create the levels
-               self.level1 = level.Level (cPickle.load (file ("levels/level1.dat")),
+               self.level1 = level.Level (cPickle.load (file (os.path.join ("levels", "level1.dat"))),
                                objects = [ chest1 ] )
 
-               self.level1w = level.Level (cPickle.load (file ("levels/level1w.dat")))
+               self.level1w = level.Level (cPickle.load (file (os.path.join ("levels", "level1w.dat"))))
 
-               self.level1e = level.Level (cPickle.load (file ("levels/level1e.dat")),
+               self.level1e = level.Level (cPickle.load (file (os.path.join ("levels", "level1e.dat"))),
                                objects = [ key1, potion, chest2 ], npcs = [ npc_bulisa ])
 
+               self.level1ee = level.Level (cPickle.load (file (os.path.join ("levels", "level1ee.dat"))),
+                               objects = [ well1, well2, well3, well4 ])
+
+               self.level1n = level.Level (cPickle.load (file (os.path.join ("levels", "level1n.dat"))),
+                               objects = [ bucket ])
+
                # set up the interaction between levels
                self.level1.levelright = self.level1e
                self.level1.levelleft = self.level1w
                self.level1e.levelleft = self.level1
+               self.level1e.levelright = self.level1ee
+               self.level1ee.levelleft = self.level1e
                self.level1w.levelright = self.level1
+               self.level1.leveltop = self.level1n
+               self.level1n.levelbottom = self.level1
 
        def main_loop (self):
                # main game loop
@@ -267,7 +284,6 @@ class MainGame:
        def interact_npc_bulisa (self, npc):
                # set initial response ID to none
                resp_id = None
-               print (gamestate.mission_bulisa_water_from_well, gamestate.mission_bulisa_water_from_well_complete)
                # not yet started mission drawing water from well and not refused it
                if (gamestate.mission_bulisa_water_from_well is False
                        and gamestate.mission_bulisa_water_from_well_refused is False):
@@ -280,14 +296,25 @@ class MainGame:
                        # set the current dialog
                        npc.currentdialog = 2
                        resp_id = utility.dialogue_play (self.screen, self.img_dialogue, npc, self.img_butaba_portrait, 0, 90)
-               # mission accepted but not completed
+               # mission accepted but not completed - check if completed and set value
+               # accordingly
                elif (gamestate.mission_bulisa_water_from_well is True
                        and gamestate.mission_bulisa_water_from_well_complete is False):
-                       npc.currentdialog = 1
+                       for invobj in self.butaba.objects:
+                               if isinstance (invobj, gameobjects.Bucket) is True:
+                                       if invobj.liquid == "water":
+                                               gamestate.mission_bulisa_water_from_well_complete = True
+                                               self.butaba.objects.remove (invobj)
+                                               break
+                       # water mission is not completed yet
+                       if gamestate.mission_bulisa_water_from_well_complete is False:
+                               npc.currentdialog = 1
+                       else:
+                               npc.currentdialog = 3
+
                        # get the response ID
                        resp_id = utility.dialogue_play (self.screen, self.img_dialogue, npc, self.img_butaba_portrait, 0, 90)
 
-               print resp_id
                # if response ID is 12, then drawing water from well mission is refused
                if resp_id == "12" or resp_id == "18":
                        gamestate.mission_bulisa_water_from_well_refused = True
@@ -394,6 +421,32 @@ class MainGame:
                        self.status_message = "You picked up %d gold." % obj.value
                        # remove the gold coins after adding it to Butaba's gold
                        container.objects.remove (obj)
+               # using a bucket means emptying it
+               elif isinstance (obj, gameobjects.Bucket) is True:
+                       if obj.liquid is not None:
+                               self.status_message = "You emptied the bucket of %s" % obj.liquid
+                               obj.use (self.butaba)
+                       else:
+                               self.status_message = "Bucket is already empty."
+               # using a well
+               elif isinstance (obj, gameobjects.Well) is True:
+                       # if the well is not dry, i.e. it has some liquid
+                       if obj.liquid is not None:
+                               # search butaba inventory for an empty bucket
+                               for invobj in self.butaba.objects:
+                                       # bucket found, now check if it is empty
+                                       if isinstance (invobj, gameobjects.Bucket) is True:
+                                               # if empty fill it
+                                               if invobj.liquid is None:
+                                                       obj.use (invobj)
+                                                       self.status_message = "You successfully filled the %s with %s" % (invobj.text, obj.liquid)
+                                                       if self.butaba.strength < constants.STRENGTHMAX_DRAW_WELL_WATER:
+                                                               self.butaba.strength += 2
+                                                               self.status_message += " and gained strength!"
+                                                       return
+                               self.status_message = "You have no empty bucket to draw %s with!" % obj.liquid
+                       else:
+                               self.status_message = "%s appears to be dry!" % obj.text
 
        def move_butaba_left (self):
                # clear any status messages
diff --git a/objects/bucket.png b/objects/bucket.png
new file mode 100644 (file)
index 0000000..3b45fb9
Binary files /dev/null and b/objects/bucket.png differ