I have created a class for the zombie I blit into the screen, but the rotation does not work at all, it rotates a lot and moves the image around, is there some way to rotate the image around its center? how could I change the rotate def so that it works properly?
class zombieObj:
def __init__(self, x, y, vel, angle):
tempZombie = pygame.image.load('zombieSprite.png')
self.zombieSpriteSurface = pygame.transform.scale(tempZombie, (64, 64))
self.x = x
self.y = y
self.vel = 1
self.angle = angle
def rotate(self, image, angle):
self.zombieSpriteSurface = pygame.transform.rotate(image, angle)
and this is how I called it in the loop:
zombieSprite.angle = zombieSprite.angle + 5
zombieSprite.rotate(zombieSprite.zombieSpriteSurface, zombieSprite.angle)