Python pygame 模块,K_f() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用pygame.K_f()

项目:Arkon    作者:UnkDevE    | 项目源码 | 文件源码
def run(self):
        # while no other GUI elements are visible or not in battle
        while this.drawing & (not (this.text_box_visible | this.text_menu_visible | this.inbattle)):
            pygame.event.pump()

            event = pygame.event.poll()

            if event.type == pygame.KEYDOWN:
                # get keys pressed using pygame.key.get_pressed() as it is more continous than events.
                if event.key == pygame.K_LCTRL:
                    # seperate hide and show buttons as they would counteract eachother.
                    self.player_menu.show()
                elif event.key == pygame.K_z:
                    self.activate()
                elif event.key == pygame.K_f:
                    # quick testing key to find if the battles work has to be with a background
                    #  where Lucidia Bright is present.
                    battle(self, this.onscreen_sprites["Lucida Bright"])

            pygame.time.delay(5)

            keys = pygame.key.get_pressed()

            if keys[pygame.K_UP]:
                self.facing("backward")
                self.move(0, -1)
            elif keys[pygame.K_DOWN]:
                self.facing("forward")
                self.move(0, 1)
            elif keys[pygame.K_LEFT]:
                self.facing("left")
                self.move(-1, 0)
            elif keys[pygame.K_RIGHT]:
                self.facing("right")
                self.move(1, 0)