Ejemplo n.º 1
0
def new_game():
    global player, inventory, game_msgs, game_state, dungeon_level, objects
	
    o.objects = []
    #create object representing the player
    fighter_component = Fighter(hp=100, defense=1, power=2, xp=0, death_function=player_death)
    player = o.Object(0, 0, '@', 'player', ltc.white, blocks=True, fighter=fighter_component)
	

    player.level = 1

    #generate map (at this point it's not drawn to the screen)
    #dungeon_level = 1
    m.make_map()
    m.initialize_fov()
 
    game_state = 'playing'
    inventory = []

 
    #create the list of game messages and their colors, starts empty
    game_msgs = []
 
    #a warm welcoming message!
    message('Welcome stranger! Prepare to perish in the Tombs of the Ancient Kings.', ltc.red)
 
    #initial equipment: a dagger
    equipment_component = Equipment(slot='right hand', power_bonus=2)
    obj = o.Object(0, 0, '-', 'dagger', ltc.sky, equipment=equipment_component)
    inventory.append(obj)
    equipment_component.equip()
    obj.always_visible = True
    print "new_game pass"
Ejemplo n.º 2
0
def load_game(filename="savegame"):
    file = shelve.open(filename, "r")
    Game.map = file["map"]
    Game.objects = file["objects"]
    Game.player = Game.objects[file["player_index"]]  # get index of player in the objects list
    Game.inventory = file["inventory"]
    Game.game_msgs = file["game_msgs"]
    Game.game_state = file["game_state"]
    Game.stairs = Game.objects[file["stairs_index"]]
    Game.dungeon_level = file["dungeon_level"]
    file.close()

    map.initialize_fov(Game)
Ejemplo n.º 3
0
def load_game(filename='savegame'):
    file = shelve.open(filename, 'r')
    Game.map = file['map']
    Game.objects = file['objects']
    Game.player = Game.objects[
        file['player_index']]  #get index of player in the objects list
    Game.inventory = file['inventory']
    Game.game_msgs = file['game_msgs']
    Game.game_state = file['game_state']
    Game.stairs = Game.objects[file['stairs_index']]
    Game.dungeon_level = file['dungeon_level']
    file.close()

    map.initialize_fov(Game)
Ejemplo n.º 4
0
def new_game():
    #create object representing the player
    fighter_component = entities.Fighter(hp=100,
                                         defense=3,
                                         power=6,
                                         xp=0,
                                         death_function=entities.player_death)
    Game.player = entities.Object(data.SCREEN_WIDTH / 2,
                                  data.SCREEN_HEIGHT / 2,
                                  '@',
                                  'Roguetato',
                                  libtcod.white,
                                  tilechar=data.TILE_MAGE,
                                  blocks=True,
                                  fighter=fighter_component)

    Game.player.level = 1
    #generate map (at this point it's not drawn to screen)
    Game.dungeon_level = 1

    map.make_map(Game)
    map.initialize_fov(Game)

    Game.game_state = data.STATE_PLAYING
    Game.inventory = []

    #create the list of the game messages and their colors, starts empty
    Game.player.game_turns = 0

    #initial equipment
    equipment_component = entities.Equipment(slot='wrist', max_hp_bonus=5)
    obj = entities.Object(0,
                          0,
                          '-',
                          'wristguards of the whale',
                          libtcod.gold,
                          equipment=equipment_component)
    Game.inventory.append(obj)
    equipment_component.equip(Game)
    obj.always_visible = True

    #a warm welcoming message!
    message('Welcome to MeFightRogues! Good Luck! Don\'t suck!', Game,
            libtcod.blue)
Ejemplo n.º 5
0
def new_game():
    # create object representing the player
    fighter_component = entities.Fighter(hp=100, defense=3, power=6, xp=0, death_function=entities.player_death)
    Game.player = entities.Object(
        data.SCREEN_WIDTH / 2,
        data.SCREEN_HEIGHT / 2,
        "@",
        "Roguetato",
        libtcod.white,
        tilechar=data.TILE_MAGE,
        blocks=True,
        fighter=fighter_component,
    )

    Game.player.level = 1
    # generate map (at this point it's not drawn to screen)
    Game.dungeon_level = 1

    map.make_map(Game)
    map.initialize_fov(Game)

    Game.game_state = data.STATE_PLAYING
    Game.inventory = []

    # create the list of the game messages and their colors, starts empty
    Game.player.game_turns = 0

    # initial equipment
    equipment_component = entities.Equipment(slot="wrist", max_hp_bonus=5)
    obj = entities.Object(0, 0, "-", "wristguards of the whale", libtcod.gold, equipment=equipment_component)
    Game.inventory.append(obj)
    equipment_component.equip(Game)
    obj.always_visible = True

    # a warm welcoming message!
    message("Welcome to MeFightRogues! Good Luck! Don't suck!", Game, libtcod.blue)