When I'm using sprites in my pygame-based game they don't seem to work properly - as you can see on the screenshot they don't have the right shape and have some weird distortion in the upper part.
Black squares have distortions on the top; sprite in the centre must be something like arrow-shaped.
Piece of code involved in loading images (copypasted right from pygame's tutorials):
def load_image(name, colorkey=None):
fullname = os.path.join('data', 'images')
fullname = os.path.join(fullname, name)
try:
image = pygame.image.load(fullname)
except pygame.error as message:
print('Cannot load image:', fullname)
raise SystemExit(message)
image = image.convert()
if colorkey is not None:
if colorkey is -1:
colorkey = image.get_at((0,0))
image.set_colorkey(colorkey, RLEACCEL)
return image, image.get_rect()
I've been doing my project on Python 2.7.11 and 3.4.2 on Mac OS X and got this issue. But when I tested it on Python 3.1 on Windows, problem didn't show up and sprites loaded normally. So I think it's something about Mac OS X.
Are you on El Capitan (OS X 10.11)? If so, you are seeing a known bug in SDL_image on that version of OS X. See this link for details and a possible workaround:
https://bitbucket.org/pygame/pygame/issues/284/max-osx-el-capitan-using-the-deprecated