Example #1
0
    def new_game():
        Game.state = 'playing'
        Game.dungeon_level = 1
        Game.game_msgs = []
        Game.mouse = libtcod.Mouse()
        Game.key = libtcod.Key()
        Game.inventory = []
        Game.panel = libtcod.console_new(Game.SCREEN_WIDTH, Game.PANEL_HEIGHT)
        Game.map = Map(Game.MAP_WIDTH, Game.MAP_HEIGHT)

        libtcod.console_clear(Game.main_console)

        _fighter_component = Components.Fighter(
            hp=100,
            dexterity=4,
            accuracy=20,
            power=4,
            xp=0,
            death_function=Components.player_death)
        Game.player = Object(Game.map.origin[0],
                             Game.map.origin[1],
                             '@',
                             'Drew',
                             libtcod.pink,
                             blocks=True,
                             fighter=_fighter_component)
        Game.player.level = 1
        Game.map.add_object(Game.player)

        _equipment_component = Equipment(slot='right hand', power_bonus=2)
        _obj = Object(0,
                      0,
                      '-',
                      'dagger',
                      libtcod.sky,
                      equipment=_equipment_component)
        Game.inventory.append(_obj)
        _equipment_component.equip()

        Game.message(
            'Welcome stranger! Prepare to perish in the Tombs of the Ancient Kings.',
            libtcod.light_green)
Example #2
0
	def new_game():
		Game.state = 'playing'
		Game.dungeon_level = 1
		Game.game_msgs = []
		Game.mouse = libtcod.Mouse()
		Game.key = libtcod.Key()
		Game.inventory = []
		Game.panel = libtcod.console_new(Game.SCREEN_WIDTH, Game.PANEL_HEIGHT)
		Game.map = Map(Game.MAP_WIDTH, Game.MAP_HEIGHT)

		libtcod.console_clear(Game.main_console)

		_fighter_component = Components.Fighter(hp=100, dexterity=4, accuracy=20, power=4, xp=0, death_function=Components.player_death)
		Game.player = Object(Game.map.origin[0], Game.map.origin[1], '@', 'Drew', libtcod.pink, blocks=True, fighter=_fighter_component)
		Game.player.level = 1
		Game.map.add_object(Game.player)

		_equipment_component = Equipment(slot='right hand', power_bonus=2)
		_obj = Object(0, 0, '-', 'dagger', libtcod.sky, equipment=_equipment_component)
		Game.inventory.append(_obj)
		_equipment_component.equip()

		Game.message('Welcome stranger! Prepare to perish in the Tombs of the Ancient Kings.', libtcod.light_green)