Ignore:
Timestamp:
07/01/09 20:16:02 (10 years ago)
Author:
meggie_parpg
Message:

Added new objectLoader. Changed GameObject? constructor to take an xpos and a ypos instead of a tuple, which was necessary because of the way the dictionary unpacking works. Changed the default gfx in WoodenCrate? to make it so that the view can understand it. Added something to engine so that it will make the crate. Ugly hard-coding to get rid of later.

File:
1 edited

Legend:

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

    r177 r178  
    2424from gamestate import GameState 
    2525from gamedata import * 
     26from objectLoader import ObjectXMLParser 
    2627 
    2728# design note: 
     
    120121        # now open and read the XML file 
    121122        cur_handler = LocalXMLParser() 
     123        other_handler = ObjectXMLParser() 
    122124        parser = cur_handler.getParser() 
    123125        parser.setContentHandler(cur_handler) 
    124126        parser.parse(objects_file) 
     127        objects_file.seek(0) 
     128        other_handler.getObjects(objects_file) 
    125129        objects_file.close() 
    126130        # must have at least 1 PC 
     
    133137        self.addObjects(cur_handler.objects) 
    134138        self.addDoors(cur_handler.doors) 
     139        self.addGameObjs(other_handler.local_info) 
    135140        return True 
     141 
     142    def addGameObjs(self, objList): 
     143        """Add all found game objects to the world 
     144           @type objList: list 
     145           @param objList: a list of the objects found in the xml file 
     146           @return: None""" 
     147        for obj in objList: 
     148            print obj.X, obj.Y, obj.gfx['map'], obj.ID 
     149            self.view.addObject(obj.X, obj.Y, obj.gfx['map'], obj.ID) 
    136150 
    137151    def addPC(self,pc): 
Note: See TracChangeset for help on using the changeset viewer.