def populate_map_entities(self, _map_data, _map_layer_entities): for _entity in _map_layer_entities: if _entity[0] == 1: new_entity_surface = resource_loader.load_sprite('thug') new_entity = NPC(new_entity_surface, intent_instance=self._Intent(), inventory_instance=Inventory()) new_entity.name = "Thug" assert isinstance(new_entity, NPC) new_entity.move(*_entity[1]) _map_data.character_layer[_entity[1]] = new_entity
def populate_map_entities(self, _map_data, _map_layer_entities, resource_loader_inst, inventory_class): for _entity in _map_layer_entities: if _entity[0] == 0: hero_position = _entity[1] elif _entity[0] == 1: new_entity_surface = resource_loader_inst.load_sprite('thug') new_inventory = inventory_class() new_entity = NPC(new_entity_surface, intent_instance=self._Intent(), inventory_instance=new_inventory) new_entity.name = "Thug" assert isinstance(new_entity, NPC) new_entity.move(*_entity[1]) _map_data.character_layer[_entity[1]] = new_entity try: return hero_position except NameError: pass return None