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
def flush(): cod.console_flush()