Exemple #1
0
 def generate_board(self):
     self.board = [[0]*8 for i in range(8)]
     level = get_level(self.level)
     pos = 0
     for i in range(0, 8):
         for j in range(0, 8):
             self.board[i][j] = level[pos]
             pos += 1
Exemple #2
0
 def level(self):
     return get_level(self.species_number, self.experience_points)
Exemple #3
0
                for item in items_list:
                    if item.item_name == saved_weapon:
                        player_inventory = Backpack(item, save_data[3])
            else:
                player_inventory = Backpack(None, save_data[3])

            saved_items = save_data[4].split(',')
            for item in items_list:
                for saved_item in saved_items:
                    if saved_item == item.item_name:
                        player_inventory.items.append(item)

            level_no = save_data[1]
            level_type = save_data[6]
            level_layout = save_data[7]
            level_coords = get_level(level_layout)
            current_level = Level(level_no, level_type, level_coords)
            hero.rect.x = current_level.level_entrance[0] + tile_width
            hero.rect.y = current_level.level_entrance[1]

            # Build a list of items already found on the level so that reloading doesn't respawn all items
            saved_found_items = save_data[5].split('.')
            if saved_found_items[0]:
                for found_item in saved_found_items:
                    found_item_split = found_item.split(',')
                    if not found_items_rects:
                        found_items_rects = [
                            pygame.Rect(int(found_item_split[0]),
                                        int(found_item_split[1]), tile_width,
                                        tile_height)
                        ]