Particle when player is hit
This commit is contained in:
parent
9504a8213c
commit
6543de826a
@ -17,6 +17,8 @@ class Player(Movable):
|
|||||||
self.spritefalling = game.sprite_lib["player/falling.png"] # Descending
|
self.spritefalling = game.sprite_lib["player/falling.png"] # Descending
|
||||||
self.spritehurt = game.sprite_lib["player/hurt.png"] # Being hurted
|
self.spritehurt = game.sprite_lib["player/hurt.png"] # Being hurted
|
||||||
self.spritelanding = game.sprite_lib["player/landing.png"]
|
self.spritelanding = game.sprite_lib["player/landing.png"]
|
||||||
|
|
||||||
|
self.ouch = game.getchars("Ouch !")
|
||||||
self.landingtimer = 0
|
self.landingtimer = 0
|
||||||
self.maxlandtime = 0.15
|
self.maxlandtime = 0.15
|
||||||
self.spriteindex = 0
|
self.spriteindex = 0
|
||||||
@ -298,6 +300,8 @@ class Player(Movable):
|
|||||||
self.hp-=dmg
|
self.hp-=dmg
|
||||||
if self.hp<=0:
|
if self.hp<=0:
|
||||||
self.die()
|
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):
|
def die(self):
|
||||||
if not self.dead:
|
if not self.dead:
|
||||||
|
Loading…
Reference in New Issue
Block a user