本文整理汇总了Python中pygame.K_l方法的典型用法代码示例。如果您正苦于以下问题:Python pygame.K_l方法的具体用法?Python pygame.K_l怎么用?Python pygame.K_l使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pygame
的用法示例。
在下文中一共展示了pygame.K_l方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: keyup
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import K_l [as 别名]
def keyup(self, key):
""" Update velocities based on key released
Arguments:
key: pygame key
"""
if key == pygame.K_UP or key == pygame.K_DOWN: # set zero forward/backward velocity
self.for_back_velocity = 0
elif key == pygame.K_LEFT or key == pygame.K_RIGHT: # set zero left/right velocity
self.left_right_velocity = 0
elif key == pygame.K_w or key == pygame.K_s: # set zero up/down velocity
self.up_down_velocity = 0
elif key == pygame.K_a or key == pygame.K_d: # set zero yaw velocity
self.yaw_velocity = 0
elif key == pygame.K_t: # takeoff
self.tello.takeoff()
self.send_rc_control = True
elif key == pygame.K_l: # land
not self.tello.land()
self.send_rc_control = False
示例2: handle_event
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import K_l [as 别名]
def handle_event(self, event: pygame.event.EventType) -> None:
"""
Handle pygame events for moving and zooming in the displayed area.
:param event: a pygame event
"""
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_l:
self.scaling *= 1 / self.SCALING_FACTOR
if event.key == pygame.K_o:
self.scaling *= self.SCALING_FACTOR
if event.key == pygame.K_m:
self.centering_position[0] -= self.MOVING_FACTOR
if event.key == pygame.K_k:
self.centering_position[0] += self.MOVING_FACTOR
示例3: events
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import K_l [as 别名]
def events(self):
# catch all events here
for event in pg.event.get():
if event.type == pg.QUIT:
self.quit()
if event.type == pg.KEYDOWN and event.key == pg.K_ESCAPE:
self.quit()
# TODO: remove this
if event.type == pg.KEYDOWN and event.key == pg.K_l:
self.light = not self.light