Exemplo n.º 1
0
 def draw(self):
     #set the color and then draw the character that represents this object at its position
     libtcod.console_set_default_foreground(con, self.color)
     libtcod.console_put_char(con, self.x, self.y, self.char, libtcod.BKGND_NONE)
Exemplo n.º 2
0
        playerx -= 1
 
    elif libtcod.console_is_key_pressed(libtcod.KEY_RIGHT):
        playerx += 1
 
 
#############################################
# Initialization & Main Loop
#############################################
 
libtcod.console_set_custom_font('fonts/arial12x12.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)
 
playerx = SCREEN_WIDTH/2
playery = SCREEN_HEIGHT/2
 
while not libtcod.console_is_window_closed():
 
    libtcod.console_set_default_foreground(0, libtcod.white)
    libtcod.console_put_char(0, playerx, playery, '@', libtcod.BKGND_NONE)
 
    libtcod.console_flush()
 
    libtcod.console_put_char(0, playerx, playery, ' ', libtcod.BKGND_NONE)
 
    #handle keys and exit game if needed
    exit = handle_keys()
    if exit:
        break
Exemplo n.º 3
0
 def put_map_char(self, char, x, y,
                  fg_color=cod.white, bg_color=cod.BKGND_NONE):
     cod.console_set_default_foreground(self.map_console, fg_color)
     cod.console_put_char(self.map_console, x, y, char, bg_color)