本文整理汇总了Python中pygame.K_t方法的典型用法代码示例。如果您正苦于以下问题:Python pygame.K_t方法的具体用法?Python pygame.K_t怎么用?Python pygame.K_t使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pygame
的用法示例。
在下文中一共展示了pygame.K_t方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: keyup
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import K_t [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: KeyDown
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import K_t [as 别名]
def KeyDown(self,event):
"""
if event.key == pygame.K_PAGEUP:
self.EasingAllPageLeft()
#self.SwapAndShow()
if event.key == pygame.K_PAGEDOWN:
self.EasingAllPageRight()
#self.SwapAndShow()
"""
if event.key == pygame.K_t:
self.DrawRun()
self.SwapAndShow()
"""
if event.key == CurKeys["Space"]:
self._CounterScreen.Draw()
self._CounterScreen.SwapAndShow()
self._CounterScreen.StartCounter()
"""
## leave rest to Pages
current_page_key_down_cb = getattr(self._CurrentPage,"KeyDown",None)
if current_page_key_down_cb != None:
if callable( current_page_key_down_cb ):
self._CurrentPage.KeyDown(event)
self._LastKey = event.key
示例3: __init__
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import K_t [as 别名]
def __init__(self, input, target):
super().__init__()
self.input = input
self.target = target
# forward vector stays level with horizontal plane
self.forward = np.array( [0, 0, -1] )
# up vector is constant
self.up = np.array( [0,1,0] )
# recalculate right vector whenever forward vector changes
self.right = np.cross( self.forward, self.up )
# control rate of movement
self.deltaTime = 1.0/60.0 # TODO: get actual number from input?
self.unitsPerSecond = 1
self.moveAmount = self.unitsPerSecond * self.deltaTime
self.degreesPerSecond = 60
self.turnAmount = self.degreesPerSecond * (3.1415926 / 180) * self.deltaTime
# customizable key mappings
# standard controls (WASDRF, QETG)
self.KEY_MOVE_FORWARDS = pygame.K_w
self.KEY_MOVE_BACKWARDS = pygame.K_s
self.KEY_MOVE_LEFT = pygame.K_a
self.KEY_MOVE_RIGHT = pygame.K_d
self.KEY_MOVE_UP = pygame.K_r
self.KEY_MOVE_DOWN = pygame.K_f
self.KEY_TURN_LEFT = pygame.K_q
self.KEY_TURN_RIGHT = pygame.K_e
self.KEY_LOOK_UP = pygame.K_t
self.KEY_LOOK_DOWN = pygame.K_g