【发布时间】:2013-10-20 05:02:48
【问题描述】:
我正在使用 pygame 制作游戏,我希望玩家面对十字准线,这是我拥有的代码,我让它打印出空闲时的角度,我注意到所有错误的角度和玩家无论如何都没有旋转。我已经看到了一些其他类似的问题并且我已经关注了它们,但是我仍然得到错误的角度并且图像无论如何都不会旋转
这是我的角度和旋转图像代码:
mouse_x, mouse_y = pygame.mouse.get_pos()
mouse_x -= crosshair.get_width() / 2
mouse_y -= crosshair.get_height() / 2
player_atan = math.atan2(player_x-player_y, mouse_x-mouse_y)
player_angle = degrees(player_atan)
pygame.transform.rotate(screen, player_angle)
【问题讨论】: