当前位置: 首页>>代码示例>>Python>>正文


Python GameState.render_all方法代码示例

本文整理汇总了Python中GameState.render_all方法的典型用法代码示例。如果您正苦于以下问题:Python GameState.render_all方法的具体用法?Python GameState.render_all怎么用?Python GameState.render_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameState的用法示例。


在下文中一共展示了GameState.render_all方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: follow_line

# 需要导入模块: import GameState [as 别名]
# 或者: from GameState import render_all [as 别名]
def follow_line(source, target, projectile='-', end_tile='*', color=libtcod.yellow):

    if Constants.ANIMATE_ON:
        line = Utils.get_line((source.x, source.y), (target.x, target.y))
        for loc in line:
            Render.clear_layer(Render.layers['animation_console'])
            map_x, map_y = loc

            GameState.render_all()

            x, y = Utils.to_camera_coordinates(map_x, map_y)

            if (x, y) == line[-1]:
                Render.draw_char(Render.layers['animation_console'], x, y, end_tile, color)

            else:
                Render.draw_char(Render.layers['animation_console'], x, y, projectile, color)

            terminal.refresh()
            # time.sleep(0.01325) # 0.01325
        Render.clear_layer(Render.layers['animation_console'])
开发者ID:joekane,项目名称:DeepFriedSuperNova,代码行数:23,代码来源:Animate.py

示例2: take_turn

# 需要导入模块: import GameState [as 别名]
# 或者: from GameState import render_all [as 别名]
    def take_turn(self):
        global vCount
        GameState.render_all()


        mouse = Input.mouse


        while True:

            # print "Waiting for input"

            """
            On player turn this loops continuasouly waiting for user input
            """
            Input.update()
            key = Input.key
            GameState.render_ui()



            """
            Check mouse status
            """
            mouse_click_value = self.process_mouse_clicks(mouse)
            mouse_hover_value = self.process_mouse_hover(mouse)
            if mouse_click_value > 0:
                return self.end_turn(mouse_click_value)
            if mouse_hover_value > 0:
                return self.end_turn(mouse_hover_value)


            """
            Auto-Walking
            """
            # TODO: Make autowalk pathing calculate paths based on NO monsters. Otherwise you can tell when paths are blocked. Stop when encounter...
            if GameState.continue_walking:
                self.owner.walk_path()
                # print "Auto-Walking"
                return self.end_turn(Constants.TURN_COST)
            elif not GameState.continue_walking:
                self.owner.clear_path()

            """
            Basic User Input
            """

            # TODO: Make movement cost relative to terrain. (add terrain cost to TILE)  WATER / TAR / OIL / SAND = Slower, Road / Trail = Fsater
            # TODO: Make turns not pass as you bumb into walls.

            # TODO: Add 'Auto-Explore' --- Search for Not self.Explored, path to it as if you right clicked.

            if key == terminal.TK_KP_8 or key == terminal.TK_UP:
                GameState.player_move_or_interact(0, -1)
                return self.end_turn(Constants.TURN_COST)
            elif key == terminal.TK_KP_2 or key == terminal.TK_DOWN:
                GameState.player_move_or_interact(0, 1)
                return self.end_turn(Constants.TURN_COST)
            elif key == terminal.TK_KP_4 or key == terminal.TK_LEFT:
                GameState.player_move_or_interact(-1, 0)
                return self.end_turn(Constants.TURN_COST)
            elif key == terminal.TK_KP_6 or key == terminal.TK_RIGHT:
                GameState.player_move_or_interact(1, 0)
                return self.end_turn(Constants.TURN_COST)
            elif key == terminal.TK_KP_7: # or (terminal.TK_LEFT and terminal.TK_UP):
                GameState.player_move_or_interact(-1, -1)
                return self.end_turn(Constants.TURN_COST)
            elif key == terminal.TK_KP_9:
                GameState.player_move_or_interact(1, -1)
                return self.end_turn(Constants.TURN_COST)
            elif key == terminal.TK_KP_1:
                GameState.player_move_or_interact(-1, 1)
                return self.end_turn(Constants.TURN_COST)
            elif key == terminal.TK_KP_3:
                GameState.player_move_or_interact(1, 1)
                return self.end_turn(Constants.TURN_COST)
            elif key == terminal.TK_KP_5:
                return self.end_turn(Constants.TURN_COST)
            elif key == terminal.TK_X:
                GameState.current_level.require_recompute()
                Constants.DEBUG = not Constants.DEBUG
                GameState.render_all()
            elif key == terminal.TK_G:
                # pick up an item
                for object in GameState.current_level.get_all_objects():  # look for an item in the player's tile
                    if object.x == self.owner.x and object.y == self.owner.y and object.item:
                        object.item.pick_up()
                        break
            elif key == terminal.TK_F:
                for obj in GameState.get_all_equipped(self.owner):
                    if obj.owner.ranged:
                        outcome = obj.owner.ranged.fire()
                        if outcome == 'cancelled':
                            return 0
                        else:
                            return self.end_turn(Constants.TURN_COST)
            elif key == terminal.TK_B:
                title = "Beastiary"

                text = '\n\nDrag Header to move window\n\n'
#.........这里部分代码省略.........
开发者ID:joekane,项目名称:DeepFriedSuperNova,代码行数:103,代码来源:Components.py


注:本文中的GameState.render_all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。