我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用pygame.K_l()。
def control_update(self): ''' Uses input from the keyboard to control the player. ''' keys_pressed = pygame.key.get_pressed() action_map = { pygame.K_SPACE: ('hop', INITIAL_HOP), pygame.K_l: ('leap', INITIAL_LEAP), pygame.K_d: ('run', 2), } action = ('run', 0) for key in action_map: if keys_pressed[key]: action = action_map[key] break reward, end_episode = self.simulator.update(action, DT, True) self.total += reward if end_episode: print 'Episode Reward:', self.total self.total = 0.0 self.simulator = Simulator()