Fixed shadow opacity

This commit is contained in:
theo@manjaro 2021-09-17 15:46:00 +02:00
parent 4945594a6f
commit 44b5ef0321

View File

@ -7,7 +7,7 @@ class Spawner(BaseObject):
def __init__(self,game,tiles,speedmargin=5): def __init__(self,game,tiles,speedmargin=5):
spawnpoint = random.choice(tiles.spawns) spawnpoint = random.choice(tiles.spawns)
super().__init__(spawnpoint[0],spawnpoint[1],game) super().__init__(spawnpoint[0],spawnpoint[1],game)
self.sprite = game.sprite_lib["lemmings/shadow.png"] self.sprite = game.sprite_lib["lemmings/shadow.png"].copy()
self.speedmargin = speedmargin self.speedmargin = speedmargin
self.fallsprite = game.sprite_lib["lemmings/falling.png"] self.fallsprite = game.sprite_lib["lemmings/falling.png"]
self.distance = game.DISPLAY_HEIGHT self.distance = game.DISPLAY_HEIGHT
@ -31,8 +31,6 @@ class Spawner(BaseObject):
def draw(self): def draw(self):
# Draw the shadow # Draw the shadow
alphavalue = 1-self.timer.getratio() alphavalue = 1-self.timer.getratio()
alphamax = 0.5
alphavalue/=alphamax
alphavalue = min(1,alphavalue)*255 alphavalue = min(1,alphavalue)*255
self.sprite.set_alpha(alphavalue) self.sprite.set_alpha(alphavalue)
self.game.lib.drawcenter(self.game,self.sprite,self.rect[0]-self.game.globals["camerax"],self.rect[1]-self.game.globals["cameray"]) self.game.lib.drawcenter(self.game,self.sprite,self.rect[0]-self.game.globals["camerax"],self.rect[1]-self.game.globals["cameray"])