Particle when player is hit

This commit is contained in:
theo@manjaro 2021-11-28 14:58:34 +01:00
parent 9504a8213c
commit 6543de826a
1 changed files with 4 additions and 0 deletions

View File

@ -17,6 +17,8 @@ class Player(Movable):
self.spritefalling = game.sprite_lib["player/falling.png"] # Descending
self.spritehurt = game.sprite_lib["player/hurt.png"] # Being hurted
self.spritelanding = game.sprite_lib["player/landing.png"]
self.ouch = game.getchars("Ouch !")
self.landingtimer = 0
self.maxlandtime = 0.15
self.spriteindex = 0
@ -298,6 +300,8 @@ class Player(Movable):
self.hp-=dmg
if self.hp<=0:
self.die()
else:
self.game.addParticle([self.ouch],self.rect.center[0],self.rect.center[1],fps=1,vely=-2,modvely=0.1) # "Ouch !" being displayed
def die(self):
if not self.dead: