Changeset 46 for trunk/PARPG/scripts


Ignore:
Timestamp:
04/24/09 12:47:06 (11 years ago)
Author:
maximinus_parpg
Message:

Added larger test map.
Added simple buildings.
Amended map layers.
Added coord view (press F5).

File:
1 edited

Legend:

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

    r39 r46  
    5454        self.instance_to_agent = {} 
    5555        self.transitions = [] 
    56         self.building_layer = [] 
    5756 
    5857    def reset(self): 
     
    7877            if(layer.getId()[:size]=='TransitionLayer'): 
    7978                self.transitions.append(self.map.getLayer(layer.getId())) 
    80         # add layer for buildings (assume always present, even if empty) 
    81         self.building_layer = self.map.getLayer('BuildingLayer') 
    8279        self.PC = Hero(self.model,'PC',self.agentlayer) 
    8380        self.instance_to_agent[self.PC.agent.getFifeId()] = self.PC 
     
    9188        self.view.resetRenderers() 
    9289        self.target_rotation = self.cameras['main'].getRotation() 
     90        self.cord_render=self.cameras['main'].getRenderer('CoordinateRenderer') 
    9391 
    9492    def keyPressed(self, evt): 
    95         """When a key id depressed, fife calls this routine. 
    96            Placeholder text left in so you can see how to read a value""" 
    97         keyval = evt.getKey().getValue() 
    98         keystr = evt.getKey().getAsString().lower() 
     93        """When a key is depressed, fife calls this routine.""" 
     94        key=evt.getKey() 
     95        keyval = key.getValue() 
    9996 
    100         if keystr == 't': 
    101             self.toggle_renderer ('GridRenderer') 
     97        if keyval == key.T: 
     98            self.toggle_renderer('GridRenderer') 
     99        if keyval == key.F5: 
     100            # logic would say we use similar code to above and toggle 
     101            # logic here does not work, my friend :-( 
     102            self.cord_render.setEnabled(not self.cord_render.isEnabled()) 
    102103 
    103104    def mousePressed(self, evt): 
Note: See TracChangeset for help on using the changeset viewer.