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

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

项目:WasIstDasFuer1Drone    作者:magnusja    | 项目源码 | 文件源码
def handle_controls(drone, event, pid):

    # takeoff / land
    if event.key == pygame.K_RETURN:
        drone.takeoff()
    elif event.key == pygame.K_SPACE:
        drone.land()
    # emergency
    elif event.key == pygame.K_BACKSPACE:
         drone.reset()
    # forward / backward
    elif event.key == pygame.K_w:
        drone.move_forward()
    elif event.key == pygame.K_s:
        drone.move_backward()
    # left / right
    elif event.key == pygame.K_a:
        drone.move_left()
    elif event.key == pygame.K_d:
        drone.move_right()
    # up / down
    elif event.key == pygame.K_UP:
        drone.move_up()
    elif event.key == pygame.K_DOWN:
        drone.move_down()
    # turn left / turn right
    elif event.key == pygame.K_LEFT:
        drone.turn_left()
    elif event.key == pygame.K_RIGHT:
        drone.turn_right()
    # speed
    elif event.key == pygame.K_1:
        drone.speed = 0.1
    elif event.key == pygame.K_2:
        drone.speed = 0.2
    elif event.key == pygame.K_3:
        drone.speed = 0.3
    elif event.key == pygame.K_4:
        drone.speed = 0.4
    elif event.key == pygame.K_5:
        drone.speed = 0.5
    elif event.key == pygame.K_6:
        drone.speed = 0.6
    elif event.key == pygame.K_7:
        drone.speed = 0.7
    elif event.key == pygame.K_8:
        drone.speed = 0.8
    elif event.key == pygame.K_9:
        drone.speed = 0.9
    elif event.key == pygame.K_0:
        drone.speed = 1.0
    elif event.key == pygame.K_u:
        pid.enabled = True