Changeset 558:aa01ca54dce2


Ignore:
Timestamp:
04/09/11 23:59:29 (12 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
Phase:
public
Rebase:
61633734333938343136336338343964343836373064326538346130346436383239376139646634
Message:

Add function for warping in NPCs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/gamestate.py

    r554 r558  
    111111        sprite_dict['world'] = self.world
    112112        return find_sprite(sprite_dict, 'items')
     113
     114    def create_npc_sprite(self, npc, to_level=None, to_pos=None):
     115        npcdef = self.data['npcs'][npc]
     116
     117        if to_level is not None:
     118            npcdef['level'] = to_level
     119        if to_pos is not None:
     120            npcdef['pos'] = to_pos
     121
     122        sprite_dict = npcdef.copy()
     123        sprite_dict.pop('level')
     124        sprite_dict['name'] = npc
     125        sprite_dict['world'] = self.world
     126        return find_sprite(sprite_dict, 'npcs')
Note: See TracChangeset for help on using the changeset viewer.