當前位置: 首頁>>代碼示例>>Python>>正文


Python pygame.K_l方法代碼示例

本文整理匯總了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 
開發者ID:damiafuentes,項目名稱:DJITelloPy,代碼行數:21,代碼來源:manual-control-pygame.py

示例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 
開發者ID:eleurent,項目名稱:highway-env,代碼行數:17,代碼來源:graphics.py

示例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 
開發者ID:kidscancode,項目名稱:gamedev,代碼行數:12,代碼來源:main.py


注:本文中的pygame.K_l方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。