コード例 #1
0
ファイル: main.py プロジェクト: ca5h/darktower-rl
def main_loop():
    while gl.__game_state__ == "playing" and not gui.window_closed():
        gui.render_all(map, player)
        if gl.__show_chapter__:
            gui.render_intro(gl.__chapter_text__)
            gl.__show_chapter__ = None
        gui.clear_all(map.map_critters)
        gui.render_ui(player)
        key = game_input.readkey()
        handle_key(key)
        for critter in map.map_critters:
            if gl.__game_state__ == "died":
                break
            critter.take_turn()
    game_input.readkey()
コード例 #2
0
def main_loop():
    while gl.__game_state__ == "playing" and not gui.window_closed():
        gui.render_all(map, player)
        if gl.__show_chapter__:
            gui.render_intro(gl.__chapter_text__)
            gl.__show_chapter__ = None
        gui.clear_all(map.map_critters)
        gui.render_ui(player)
        key = game_input.readkey()
        handle_key(key)
        for critter in map.map_critters:
            if gl.__game_state__ == "died":
                break
            critter.take_turn()
    game_input.readkey()
コード例 #3
0
def main_loop():
    global map
    while gl.is_playing() and not gui.window_closed():
        gui.render_map(map, player)
        if gl.__show_chapter__:
            gui.render_intro(gl.__chapter_text__)
            gl.__show_chapter__ = None
        #gui.clear_all(map.map_critters)
        gui.render_ui(player)
        key = game_input.readkey()
        cost = handle_key(key)
        if cost:
            for critter in map.critters:  #we only move critters from current level
                if gl.__game_state__ == "died":
                    game_input.readkey()
                    break
                critter.take_turn(player, cost)
        gui.render_messages(map, player)
コード例 #4
0
ファイル: main.py プロジェクト: sirvaulterscoff/darktower-rl
def main_loop():
    global map
    while gl.is_playing() and not gui.window_closed():
        gui.render_map(map, player)
        if gl.__show_chapter__:
            gui.render_intro(gl.__chapter_text__)
            gl.__show_chapter__ = None
        #gui.clear_all(map.map_critters)
        gui.render_ui(player)
        key = game_input.readkey()
        cost = handle_key(key)
        if cost:
            for critter in map.critters: #we only move critters from current level
                if gl.__game_state__ == "died":
                    game_input.readkey()
                    break
                critter.take_turn(player, cost)
        gui.render_messages(map, player)
コード例 #5
0
 def handle_input(self):
     while True:
         key = game_input.readkey()
         if key == '+' or key == libtcod.KEY_DOWN:
             self.offset = min(self.offset + 1, len(self.content) - 1)
         elif key == '-' or key == libtcod.KEY_UP:
             self.offset = max(self.offset - 1, 0)
         elif key == libtcod.KEY_PAGEUP:
             self.offset = max(self.offset - self.height, 0)
         elif key == libtcod.KEY_PAGEDOWN or key == ' ':
             self.offset = min(self.offset + self.height, len(self.content) - 1)
         elif key == libtcod.KEY_ESCAPE:
             break
         elif key == libtcod.KEY_ENTER:
             return libtcod.KEY_ENTER
         else:
             return key
         self.render()
コード例 #6
0
def handle_e_action():
    global map
    #handles actions bound to e key - eat, examine
    if gl.__lookmode__:
        gui.render_examine(player, map)
        key = game_input.readkey()
コード例 #7
0
ファイル: main.py プロジェクト: sirvaulterscoff/darktower-rl
def handle_e_action():
    global map
    #handles actions bound to e key - eat, examine
    if gl.__lookmode__:
        gui.render_examine(player, map)
        key = game_input.readkey()