Camera shake on death/hit

This commit is contained in:
theo@manjaro 2021-11-24 07:47:16 +01:00
parent f278ea73b0
commit a974acd908
1 changed files with 4 additions and 0 deletions

View File

@ -218,6 +218,8 @@ class Player(Movable):
super().step() # Actually move super().step() # Actually move
if self.rect.center[1]>self.game.globals["cameray"]+self.game.globals["camerah"]: if self.rect.center[1]>self.game.globals["cameray"]+self.game.globals["camerah"]:
self.die() self.die()
self.game.globals["scamerax"] = 4
self.game.globals["scameray"] = 4
# Updated hitrect # Updated hitrect
self.hitrect[0] = self.rect.center[0]-self.hitrect[2]/2 self.hitrect[0] = self.rect.center[0]-self.hitrect[2]/2
offset = 0 offset = 0
@ -291,6 +293,8 @@ class Player(Movable):
self.horkb = hor self.horkb = hor
self.verkb = ver self.verkb = ver
self.canfastfall = True self.canfastfall = True
self.game.globals["scamerax"] = 4
self.game.globals["scameray"] = 4
if resetcombo: if resetcombo:
self.combo = 0 self.combo = 0
self.hurtsfx.play() self.hurtsfx.play()