Exemple #1
0
    def initialize(self):

        # Basic Configuration
        cod.console_set_custom_font(
            self.config.font_path,
            cod.FONT_TYPE_GREYSCALE | cod.FONT_LAYOUT_TCOD)
        cod.console_init_root(self.config.screen_width,
                              self.config.screen_height,
                              self.config.title,
                              fullscreen=False)
        cod.sys_set_fps(self.config.fps_limit)

        # Consoles
        self.map_console = cod.console_new(self.config.screen_width,
                                           self.config.screen_height)
Exemple #2
0
    elif libtcod.console_is_key_pressed(libtcod.KEY_LEFT):
        player.move(-1, 0)

    elif libtcod.console_is_key_pressed(libtcod.KEY_RIGHT):
        player.move(1, 0)


#############################################
# Initialization & Main Loop
#############################################

libtcod.console_set_custom_font('fonts/arial10x10.png', libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD)
libtcod.console_init_root(SCREEN_WIDTH, SCREEN_HEIGHT, 'python/libtcod tutorial', False)
libtcod.sys_set_fps(LIMIT_FPS)
con = libtcod.console_new(SCREEN_WIDTH, SCREEN_HEIGHT)

#create object representing the player
player = Object(SCREEN_WIDTH/2, SCREEN_HEIGHT/2, '@', libtcod.white)

#create an NPC
npc = Object(SCREEN_WIDTH/2 - 5, SCREEN_HEIGHT/2, '@', libtcod.yellow)

#the list of objects with those two
objects = [npc, player]


while not libtcod.console_is_window_closed():

    #draw all objects in the list
    for object in objects: