我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用pygame.K_PAUSE。
def event(self, e): if e.type == pygame.KEYDOWN: #What are you doing? Looking for Cheats? #shame shame if input.Cheatstring == "wheat": snd.play('gameover') snd.play('delete') game.player.cheater = 1 self.textobjs.append(objtext.Text('"wheat" Cheat: Extra Lives')) self.lives_left += 10 self.hud.drawlives(self.lives_left) elif input.Cheatstring == "shred": snd.play('gameover') snd.play('delete') game.player.cheater = 1 self.grabbedboxes = 0 #less not give any fake complements self.levelnum = 49 self.textobjs.append(objtext.Text('"shred" Cheat: Warp Level 50')) self.changestate('levelend') if e.key == pygame.K_PAUSE or e.key == pygame.K_p: if game.handler is self: #just in case some "help" gets in first? game.handler = gamepause.GamePause(self)