Added little ghosts on death

This commit is contained in:
theo@manjaro 2021-09-18 11:07:14 +02:00
parent 1ea4887a38
commit 9750efeb63
4 changed files with 7 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

View File

@ -101,6 +101,10 @@ class Lemming(BaseObject):
for vely in range(-1,2):
self.game.addParticle(sprites,self.rect.center[0],self.rect.center[1],velx=velx/2,vely=vely/2)
# Spawn little ghost
sprites = self.game.getSpriteDir("particles/ghost/")
self.game.addParticle(sprites,self.rect.center[0],self.rect.center[1],fps=2,vely=-1)
def launch(self):
# Launch itself in the mouse direction
xdiff = self.game.inputs["mouse"]["pos"][0]-self.rect.center[0]

View File

@ -60,7 +60,7 @@ class Manager(BaseObject):
# Game over
if self.endtimer.tick(self.game.dt):
self.game.globals["score"] = int(self.score)
self.game.scenes.gameover(self.game)
self.game.scene = self.game.scenes.gameover
if self.invincible:
if self.deathtimer.tick(self.game.dt):
@ -101,6 +101,8 @@ class Manager(BaseObject):
self.game.realwindow.blit(txtsurfacelives,[20,20*2+txtsurfacescore.get_height()])
self.endrect.set_alpha((1-self.endtimer.getratio())*255)
if self.endtimer.getloops()>=1:
self.endrect.set_alpha(255)
self.game.realwindow.blit(self.endrect,[0,0])