Animating the lemming falling
This commit is contained in:
parent
8547c71d5c
commit
e28f8c8958
@ -9,6 +9,8 @@ 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.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
|
||||||
|
|
||||||
def step(self):
|
def step(self):
|
||||||
@ -19,5 +21,10 @@ class Spawner(BaseObject):
|
|||||||
self.game.gameloop.delid(self.id)
|
self.game.gameloop.delid(self.id)
|
||||||
|
|
||||||
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.rect[1]-currentdistance)
|
||||||
|
|
||||||
|
# Draw the shadow
|
||||||
self.game.lib.drawcenter(self.game,self.sprite,self.rect[0],self.rect[1])
|
self.game.lib.drawcenter(self.game,self.sprite,self.rect[0],self.rect[1])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user