Ignore:
Timestamp:
08/18/09 17:24:58 (10 years ago)
Author:
tZee_parpg
Message:

#65 Exported map data in a separate class. Next is to sort out the loading strategy (right now the call goes through the engine, then to the world and then to the map class) and the ownership of objects like the cameras.

File:
1 edited

Legend:

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

    r225 r253  
    131131        # create the extra data 
    132132        extra = {} 
    133         extra['agent_layer'] = self.view.agent_layer 
     133        extra['agent_layer'] = self.view.activeMap.agent_layer 
    134134        extra['engine'] = self 
    135135         
     
    148148           @return: None""" 
    149149        # add to view data     
    150         self.view.addObject(pc.X, pc.X, pc.gfx, pc.ID) 
     150        self.view.activeMap.addObject(pc.X, pc.X, pc.gfx, pc.ID) 
    151151         
    152152        # sync with game data 
     
    155155             
    156156        self.gameState.PC.setup() 
    157         self.view.addPC(self.gameState.PC.behaviour.agent) 
     157        self.view.activeMap.addPC(self.gameState.PC.behaviour.agent) 
    158158             
    159159        # create the PC agent 
     
    178178             
    179179        # add it to the view 
    180         self.view.addObject(obj.X, obj.Y, obj.gfx, obj.ID)           
     180        self.view.activeMap.addObject(obj.X, obj.Y, obj.gfx, obj.ID)           
    181181         
    182182        if obj.trueAttr("NPC"): 
     
    255255        self.gameState.PC.approach([npc.getLocation().getLayerCoordinates().x, npc.getLocation().getLayerCoordinates().y]) 
    256256 
    257     def loadMap(self, map_file): 
     257    def loadMap(self, map_name, map_file): 
    258258        """Load a new map. TODO: needs some error checking 
    259259           @type map_file: string 
     
    261261           @return: None""" 
    262262        # then we let FIFE load the rest of the map 
    263         self.view.load(str(map_file)) 
     263        self.view.loadMap(map_name, str(map_file)) 
     264        self.view.setActiveMap(map_name) 
    264265        # then we update FIFE with the PC, NPC and object details 
    265266        self.reset() 
Note: See TracChangeset for help on using the changeset viewer.