使用pygame旋转时,我的图像会变形并移动

时间:2014-07-13 17:13:09

标签: image python-3.x rotation pygame

我尝试过pygame.transform.rotate和pygame.transform.rotozoom。 Rotozoom工作得更好一点,但是我的图像很快就从屏幕上飞了出来,它会伸展变形,并且不会像我想的那样左右扫。我的意图是当旋转低于-50时,以另一种方式旋转,但这只会延伸更多。

                try:
                    screen.blit(Turrets[0], (TurretCoords[0]))
                    if Rotation0 == -1:
                        TurretRotation[0] = TurretRotation[0] - 1
                        Turrets[0] = pygame.transform.rotozoom(Turrets[0], -1, 1)
                        if TurretRotation[0] < -50:
                            Rotation = 1
                        else:
                            Rotation = -1
                    elif Rotation == 1:
                        TurretRotation[0] = TurretRotation[0] + 1
                        Turrets[0] = pygame.transform.rotozoom(Turrets[0], 1, 1)
                        if TurretRotation[0] > 50:
                            Rotation0 = -1
                        else:
                            Rotation0 = 1

                except:
                    pass

                try:
                    screen.blit(Turrets[1], (TurretCoords[1]))
                    if Rotation == -1:
                        TurretRotation[1] = TurretRotation[1] - 1
                        Turrets[1] = pygame.transform.rotozoom(Turrets[1], -1, 1)
                        if TurretRotation[1] < -50:
                            Rotation = 1
                    elif Rotation == 1:
                        TurretRotation[1] = TurretRotation[1] + 1
                        Turrets[1] = pygame.transform.rotozoom(Turrets[1], 1, 1)
                        if TurretRotation[1] > 50:
                            Rotation = -1
                except:
                    pass
                pygame.display.flip()

0 个答案:

没有答案