def to_json(self): ''' Serialize the important members of this class as a json object ''' json = CreatureSprite.to_json(self) json['health'] = self.health return json
def to_json(self): ''' Serialize the important members of this class as a json object ''' json = CreatureSprite.to_json(self) json['health'] = self.health json['count'] = self.count json['wep_tier'] = self.weapon_tier json['inventory'] = {} for item, num in self.inventory.items(): json['inventory'][item.name] = num json['final inventory'] = [] for item in self.final_inventory: json['final inventory'].append(item.name) json["bullets"] = self.bullets json['lives'] = self.lives return json