亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Pygame 槍在左側問題上向上旋轉視線向下

Pygame 槍在左側問題上向上旋轉視線向下

偶然的你 2023-04-25 17:27:16
所以我這里有這把槍,它朝我的鼠標 x 和鼠標 y 位置旋轉,但問題(視頻)是槍倒置了。有沒有辦法讓我的槍的圖像不倒置,并做與我的槍朝向右側相同的運動?就像左側的槍由于某種原因倒置了,我根本不知道該怎么做槍支圖片:my gun draw(self)    def draw(self,drawX,drawY):        self.rect.topleft =  (drawX,drawY)            # the gun's hitbox            # rotating the gun        dx = self.look_at_pos[0] - self.rect.centerx        dy = self.look_at_pos[1] - self.rect.centery                     angle = (180/math.pi) * math.atan2(-dy, dx)              gun_size = self.image.get_size()        pivot = (8, gun_size[1]//2)                    blitRotate(window, self.image, self.rect.center, pivot, angle)    def lookAt( self, coordinate ):                    self.look_at_pos = coordinate我的全槍課class handgun():    def __init__(self,x,y,height,width,color):        self.x = x        self.y = y        self.height = height        self.width = width        self.color = color        self.rect = pygame.Rect(x,y,height,width)        # LOL THESE IS THE HAND        self.shootsright = pygame.image.load("hands.png")        self.image = self.shootsright        self.rect  = self.image.get_rect(center = (self.x, self.y))        self.look_at_pos = (self.x, self.y)        self.isLookingAtPlayer = False        self.look_at_pos = (x,y)                    self.hitbox = (self.x + -18, self.y, 46,60)    def draw(self,drawX,drawY):        self.rect.topleft =  (drawX,drawY)            # the gun's hitbox            # rotating the gun        dx = self.look_at_pos[0] - self.rect.centerx        dy = self.look_at_pos[1] - self.rect.centery                     angle = (180/math.pi) * math.atan2(-dy, dx)              gun_size = self.image.get_size()        pivot = (8, gun_size[1]//2)                    blitRotate(window, self.image, self.rect.center, pivot, angle)    def lookAt( self, coordinate ):                    self.look_at_pos = coordinate我的完整代碼:感謝腳本 安迪的幫助謝謝!
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 99 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號