Custom sprite for the lemming's fall

This commit is contained in:
theo@manjaro 2021-09-15 16:11:18 +02:00
parent b5f893b51e
commit fda400a78b
2 changed files with 6 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

View File

@ -9,7 +9,7 @@ class Spawner(BaseObject):
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"]
self.speedmargin = speedmargin self.speedmargin = speedmargin
self.fallsprite = game.sprite_lib["lemmings/Right/0.png"] self.fallsprite = game.sprite_lib["lemmings/falling.png"]
self.distance = game.DISPLAY_HEIGHT self.distance = game.DISPLAY_HEIGHT
self.timer = game.lib.Timer(3) # Seconds of telegraph before spawning the lemming self.timer = game.lib.Timer(3) # Seconds of telegraph before spawning the lemming
@ -23,10 +23,11 @@ class Spawner(BaseObject):
self.game.globals["scameray"]+=3 self.game.globals["scameray"]+=3
def draw(self): def draw(self):
# Display the lemming falling
currentdistance = self.distance*self.timer.getratio()**2
self.game.lib.drawcenter(self.game,self.fallsprite,self.rect[0]-self.game.globals["camerax"],self.rect[1]-currentdistance-self.game.globals["cameray"])
# Draw the shadow # Draw the shadow
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"])
# Display the lemming falling
currentdistance = self.distance*self.timer.getratio()**0.9
self.game.lib.drawcenter(self.game,self.fallsprite,self.rect[0]-self.game.globals["camerax"],self.rect[1]-currentdistance-self.game.globals["cameray"])