Reputation: 882
I am using python 2.7.9 and pygame 1.9.2. Here is the relevant code:
#!/usr/bin/python
import pygame, sys
from math import *
from decimal import *
while 1:
...
deg = (atan2(Decimal(y), Decimal(x)))*180/pi
pygame.transform.rotate(surf, deg)
pygame.display.flip()
screen.fill((0, 0, 0))
print deg
clock.tick(60)
Why isn't pygame.transform.rotate working? Printing the angle using math.acos has no problem, but I just can't seem to figure out how to rotate the rect object. I tried taking out *180/pi to use radians, but that didn't work. What am I doing wrong?
Upvotes: 0
Views: 638
Reputation: 25508
I think you need:
surf = pygame.transform.rotate(surf, deg)
The pygame.transform.rotate
method seems to return a rotated object rather than rotating its coordinates in place.
Upvotes: 1