def __init__(self, screen, background, x_position, y_position, arm_type='arms'): # Loading player data json, and converitng to python dictionary with open('json/basic_character.JSON') as player_json: character_data = json.load(player_json) # Initialising Character class Character.__init__(self, character_data, background, screen, x_position, y_position, arm_type)
def __init__(self, screen, background, x_position, y_position, npc_type='basic', arm_type='arms', sleep_on_load=True): # Loading player data json, and converitng to python dictionary json_location = f'json/{npc_type}_enemy.JSON' try: with open(json_location) as character_json: character_data = json.load(character_json) except: err_string = "Bad Enemy Name. Please input an enemy which has \ a corresponding JSON" raise Exception(err_string) # Initialising Character class Character.__init__(self, character_data, background, screen, x_position, y_position, arm_type) # Setup sleep variable self.asleep = sleep_on_load self.setAttackDelay() # Kill NPC if falls off map self.max_depth = screen.get_size()[1] # Wake distance (pixels) - used to determine distance target # needs to be after which NPC wakes. # This should go somewhere else, like a JSON perhaps? # TODO: Decide! self.wake_distance = 200