Changeset 71


Ignore:
Timestamp:
05/15/09 16:34:16 (11 years ago)
Author:
bretzel_parpg
Message:

Put the inventory logic into displayInventory, which was already there and intended to be called to show/hide the inventory.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/PARPG/scripts/world.py

    r68 r71  
    123123 
    124124    def displayInventory(self): 
    125         """Pause the game and enter the inventory screen""" 
     125        """Pause the game and enter the inventory screen 
     126           or close the inventory screen and resume the game""" 
     127        # show the inventory 
     128        if(self.firstInventory == True): 
     129            self.inventory = inventory.Inventory(self.engine) 
     130            self.firstInventory = False 
     131            self.inventoryShown = True 
     132        # logically firstInventory is false here 
     133        elif(self.inventoryShown == True): 
     134            self.inventory.closeInventory() 
     135            self.inventoryShown = False 
     136        # and here inventoryShown must be false 
     137        else: 
     138            self.inventory.showInventory() 
     139            self.inventoryShown = True 
    126140 
    127141    # all key / mouse event handling routines go here 
     
    149163            self.engine.getRenderBackend().captureScreen(t) 
    150164        if(keyval == key.I): 
    151             # show the inventory 
    152             if(self.firstInventory == True): 
    153                 self.inventory = inventory.Inventory(self.engine) 
    154                 self.firstInventory = False 
    155                 self.inventoryShown = True 
    156             # logically firstInventory is false here 
    157             elif(self.inventoryShown == True): 
    158                 self.inventory.closeInventory() 
    159                 self.inventoryShown = False 
    160             # and here inventoryShown must be false 
    161             else: 
    162                 self.inventory.showInventory() 
    163                 self.inventoryShown = True 
     165            self.displayInventory() 
     166             
    164167 
    165168    def getCoords(self, click): 
Note: See TracChangeset for help on using the changeset viewer.