Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Hockey <Blitzkev@gmail.com>2010-08-04 18:36:07 (GMT)
committer Kevin Hockey <Blitzkev@gmail.com>2010-08-04 18:36:07 (GMT)
commitb698ee89240d756443555abacd336d2567ae049c (patch)
tree933fc7d66d301ba2623beac83400e097cd4071af
parent9c3fedccaa051149828d4998bc8b05ed2ee14b80 (diff)
spritesheet works with pink backgrounds
-rwxr-xr-xMAFH2/drawableobject/Spritesheet.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/MAFH2/drawableobject/Spritesheet.py b/MAFH2/drawableobject/Spritesheet.py
index 102d45c..9fac747 100755
--- a/MAFH2/drawableobject/Spritesheet.py
+++ b/MAFH2/drawableobject/Spritesheet.py
@@ -7,13 +7,13 @@ class Spritesheet:
This class can be used to seporate images from the sprite sheet
"""
def __init__(self, filename):
- self.sheet = pygame.image.load(filename).convert()
+ self.sheet = pygame.image.load(filename).convert_alpha()
self.sheet = self.imgat(self.sheet.get_rect())
def imgat(self, rect, myColorKey = None):
rect = pygame.Rect(rect)
- image = pygame.Surface(rect.size).convert()
- if myColorKey == None: myColorKey = image.get_at((0,0))
+ image = pygame.Surface(rect.size).convert_alpha()
+ if myColorKey == None: myColorKey = (255,0,255)
image.set_colorkey(myColorKey)
image.blit(self.sheet, (0, 0), rect)
return image
@@ -29,4 +29,4 @@ class Spritesheet:
for y in range(0, rows):
for x in range(0, cols):
rect_list.append( (width*x, height*y, width, height,) )
- return self.imgsat( rect_list, myColorKey) \ No newline at end of file
+ return self.imgsat( rect_list, myColorKey)