diff options
author | davesilver <nibor123@gmail.com> | 2010-08-03 20:15:39 (GMT) |
---|---|---|
committer | davesilver <nibor123@gmail.com> | 2010-08-03 20:15:39 (GMT) |
commit | 8e39fbfc8b1f97ab0aabff5e3e54b3adf3df15ac (patch) | |
tree | 83754360cb7f659a3cfaae565a767560720cdd9d | |
parent | 2d2ff8d8af2a4f8a3b4564b76ee3faaa665c5d18 (diff) |
Working on integration
-rw-r--r-- | MAFH2/fortuneengine/DrawableObject.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/MAFH2/fortuneengine/DrawableObject.py b/MAFH2/fortuneengine/DrawableObject.py index 361efbf..a06f485 100644 --- a/MAFH2/fortuneengine/DrawableObject.py +++ b/MAFH2/fortuneengine/DrawableObject.py @@ -11,26 +11,22 @@ class DrawableObject(pygame.sprite.Sprite): self._images.append(images[i].convert_alpha())
self._origImages.append(images[i].convert_alpha())
- self.blank = pygame.Surface((0,0))
- self.blank.fill((255, 255, 255, 0))
- self.blank.convert_alpha()
- self.transparent = transparent
self._start = pygame.time.get_ticks()
self._last_update = 0
self._frame = 0
self.animations = {}
self._current_anim = ""
+ self.rect = self.image.get_rect()
self.xPos = x
self.yPos = y
self.myAngle = 0
- self.image = self.blank
- if transparent == False:
- self.image = self._images[0]
-
- self.rect = self.image.get_rect()
- self.rect.topleft = (x,y)
self.xSize = self.image.get_width()
self.ySize = self.image.get_height()
+ self.rect.topleft = (x,y)
+ if transparent == False:
+ self.image = self._images[0]
+ else:
+ self.makeTransparent(transparent)
if textfileName != '':
@@ -121,7 +117,10 @@ class DrawableObject(pygame.sprite.Sprite): def makeTransparent(self, bool = True):
if bool == True:
- self._images[self._frame] = self.blank
+ surf = pygame.Surface((0,0))
+ surf.fill((255, 255, 255, 0))
+ surf.convert_alpha()
+ self._images[self._frame] = surf
else:
self._images[self._frame] = self._origImages[self._frame]
self.image = self._images[self._frame]
@@ -135,7 +134,7 @@ class DrawableObject(pygame.sprite.Sprite): if (timePassed) > 200:
- if self.transparent == False: self.image = self._images[self._frame]
+ self.image = self._images[self._frame]
self._last_update = timePassed%1000
else:
self._last_update = timePassed
|