Ignore:
Timestamp:
06/19/09 19:56:32 (10 years ago)
Author:
meggie_parpg
Message:

Added beginnings of talking functionality to the npc and hero classes. Made doors act the same way that other objects act (when it comes to item actions). Most of the door stuff will probably have to be changed when gameData/gameState stuff gets straightened out. Also, the context menu should probably close when an action is selected, but that seems to by a nasty pychan thing.

File:
1 edited

Legend:

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

    r151 r153  
    238238        actions=[] 
    239239        # note: ALWAYS check NPC's first! 
    240         # is it an NPC? 
    241240        for i in self.getObjectsFromMap(self.currentMap): 
    242241            if(obj_id == i.id): 
     
    246245                    actions.append(["Attack", "Attack", self.nullFunc, i])  
    247246                elif isinstance(i, DoorData): 
    248                     return self.doors[str(i.id)] 
     247                    actions.append(["Change Map", "Change Map", \ 
     248                            self.PC.approachDoor, [i.posx, i.posy], \ 
     249                            self.doors[str(i.id)].map, [i.destx, i.desty]]) 
    249250                elif isinstance(i, NonLivingObjectData): 
    250251                    actions.append(["Examine", "Examine", self.nullFunc, i]) 
     
    260261        """Sample callback for the context menus.""" 
    261262        print userdata 
     263     
     264    def initTalk(self, npc): 
     265        """ Starts the PC talking to an NPC. """ 
     266        # TODO: work more on this when we get NPCData and HeroData straightened 
     267        # out 
     268        npc.talk() 
     269        self.PC.approachNPC(npc.getLocation()) 
    262270 
    263271    def loadMap(self, map_file): 
     
    266274           @param map_file: Name of map file to load 
    267275           @return: None""" 
     276        # try to clear the menu 
     277        self.view.clearMenu() 
    268278        # then we let FIFE load the rest of the map 
    269279        self.view.load(str(map_file)) 
Note: See TracChangeset for help on using the changeset viewer.