예제 #1
0
파일: enemy.py 프로젝트: nhandler/cs429
    def from_json(self, json):
        '''
        Restore this object from the passed in json object

        @param json - the json object
        '''
        CreatureSprite.from_json(self, json)
        self.health = json['health']
예제 #2
0
파일: player.py 프로젝트: nhandler/cs429
    def from_json(self, json):
        '''
        Restore this object from the passed in json object

        @param json - the json object
        '''

        CreatureSprite.from_json(self, json)
        self.health = json['health']
        self.count = json['count']
        self.weapon_tier = json['wep_tier']
        self.lives = json['lives']
        self.bullets = json['bullets']
        items = get_items()
        for name, num in json['inventory'].items():
            for i in range(0, num):
                self.addItemToInventory(items[name])
        for name in json['final inventory']:
            self.addItemToInventory(items[name])