示例#1
0
文件: sample.py 项目: jdob/venture
        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
示例#2
0
文件: sample2.py 项目: jdob/venture
 def clear(self):
     #erase the character that represents this object
     libtcod.console_put_char(con, self.x, self.y, ' ', libtcod.BKGND_NONE)
示例#3
0
文件: console.py 项目: jdob/venture
 def clear_map_char(self, x, y):
     cod.console_put_char(self.map_console, x, y, ' ', cod.BKGND_NONE)
示例#4
0
文件: sample2.py 项目: jdob/venture
 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)
示例#5
0
文件: console.py 项目: jdob/venture
 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)