コード例 #1
0
ファイル: load_game.py プロジェクト: Akhier/Py-TutMut
def load_game():
    file = shelve.open('savegame.save', 'r')
    settings.map = file['map']
    settings.objects = file['objects']
    settings.player = settings.objects[file['player_index']]
    settings.inventory = file['inventory']
    settings.game_msgs = file['game_msgs']
    settings.game_state = file['game_state']
    settings.stairs = settings.objects[file['stairs_index']]
    settings.dungeon_level = file['dungeon_level']
    file.close()
    handle_keys.initialize_fov()
コード例 #2
0
ファイル: new_game.py プロジェクト: Akhier/Py-TutMut
def new_game():
    fighter_component = Fighter(hp=30, defense=2, power=5,
                                xp=0, death_function=player_death)
    settings.player = Object(0, 0, '@', 'player', color.white, blocks=True,
                             fighter=fighter_component)

    settings.player.level = 1
    settings.dungeon_level = 1
    make_map()
    handle_keys.initialize_fov()
    settings.game_state = 'playing'
    settings.inventory = []
    settings.game_msgs = []

    message('Welcome stranger. Prepare to perish in the ' +
            'Tombs of the Ancient Kings.', color.red)
    equipment_component = Equipment(slot='right hand', power_bonus=2)
    obj = Object(0, 0, '-', 'dagger', color.sky,
                 equipment=equipment_component)
    settings.inventory.append(obj)
    equipment_component.equip()
    obj.always_visible = True