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


Python GameState.next_level方法代码示例

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


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

示例1: take_turn

# 需要导入模块: import GameState [as 别名]
# 或者: from GameState import next_level [as 别名]

#.........这里部分代码省略.........

            # 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'

                pal = UI.Palette(width=20, height=20, title='Title', text=text)

                pal.draw()
            elif key == terminal.TK_COMMA and terminal.check(terminal.TK_SHIFT):
                # go down stairs, if the player is on them
                stairs = GameState.current_level.get_stairs()
                if stairs.x == self.owner.x and stairs.y == self.owner.y:
                    GameState.next_level()
                    return 1
            elif key == terminal.TK_ESCAPE:
                GameState.save_game()
                UI.display_mainMenu()
            elif key == terminal.TK_L:
                GameState.load_game()
                return 1
            elif key == terminal.TK_T:
                GameState.add_animation('FadeText', {'origin': (self.owner.x, self.owner.y),
                                                     'target': (self.owner.x, self.owner.y-1)})

            elif key == terminal.TK_O:
                print GameState.current_level.fov_map
            elif key == terminal.TK_RBRACKET:
                equipped_ranged = [equip.name for equip in GameState.inventory if equip.equipment.is_equipped and equip.ranged]

                if equipped_ranged[0] == "pistol":
                    new_weapon = [equip for equip in GameState.inventory if
                                       equip.name == 'laser']
                    new_weapon[0].equipment.equip()
                elif equipped_ranged[0] == "laser":
                    new_weapon = [equip for equip in GameState.inventory if
                                  equip.name == 'rpg']
                    new_weapon[0].equipment.equip()
                elif equipped_ranged[0] == "rpg":
                    new_weapon = [equip for equip in GameState.inventory if
                                  equip.name == 'ice wand']
                    new_weapon[0].equipment.equip()
                elif equipped_ranged[0] == "ice wand":
                    new_weapon = [equip for equip in GameState.inventory if
                                  equip.name == 'pistol']
                    new_weapon[0].equipment.equip()

            elif key == terminal.TK_LBRACKET:
                pass

                '''
开发者ID:joekane,项目名称:DeepFriedSuperNova,代码行数:104,代码来源:Components.py


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