Started on the level editor
[butaba-adventures.git] / maingame.py
index 7b54c2d..bde655d 100644 (file)
@@ -13,7 +13,7 @@ class MainGame:
        # initialize the game
        def __init__ (self):
                pygame.init ()
-               self.screen  = pygame.display.set_mode ((720, 512), pygame.FULLSCREEN)
+               self.screen  = pygame.display.set_mode ((720, 512))
                pygame.display.set_caption ("The Adventures of Butaba")
 
                # initalize background graphics
@@ -70,7 +70,8 @@ class MainGame:
                                                                        objects = [ gameobjects.Key (4, 3, "a chest key", self.img_key2, level.KEY_CHEST1),
                                                                                                gameobjects.Key (4, 3, "a room key", self.img_key, level.KEY_ROOM1),
                                                                                                gameobjects.HealthPotion (4, 2, self.img_redpotion),
-                                                                                               gameobjects.Chest (2, 5, "chest", self.img_chest, level.KEY_CHEST1, True)
+                                                                                               gameobjects.Chest (2, 5, "chest", self.img_chest, level.KEY_CHEST1, True),
+                                                                                               gameobjects.GoldCoins (5, 2, self.img_goldcoins, 50)
                                                                                        ]
                                                                                        )
                self.level1.levelright = self.level1e
@@ -272,6 +273,15 @@ class MainGame:
                        # display the contents of the chest
                        else:
                                pass
+               # if the object is gold coins
+               elif isinstance (obj, gameobjects.GoldCoins) is True:
+                       obj.use (self.butaba)
+                       self.status_message = "You picked up %d gold." % obj.value
+                       # remove the gold coins after adding it to Butaba's gold
+                       if obj in self.currentlevel.objects:
+                               self.currentlevel.objects.remove (obj)
+                       elif obj in self.butaba.inventory:
+                               self.butaba.inventory.remove (obj)
 
        def move_butaba_left (self):
                # clear any status messages