Compare commits

...

2 Commits

Author SHA1 Message Date
theo@manjaro 5ac48ac733 Player death animation 2021-11-24 07:54:47 +01:00
theo@manjaro a974acd908 Camera shake on death/hit 2021-11-24 07:47:16 +01:00
2 changed files with 7 additions and 1 deletions

View File

@ -218,6 +218,8 @@ class Player(Movable):
super().step() # Actually move
if self.rect.center[1]>self.game.globals["cameray"]+self.game.globals["camerah"]:
self.die()
self.game.globals["scamerax"] = 4
self.game.globals["scameray"] = 4
# Updated hitrect
self.hitrect[0] = self.rect.center[0]-self.hitrect[2]/2
offset = 0
@ -291,6 +293,8 @@ class Player(Movable):
self.horkb = hor
self.verkb = ver
self.canfastfall = True
self.game.globals["scamerax"] = 4
self.game.globals["scameray"] = 4
if resetcombo:
self.combo = 0
self.hurtsfx.play()
@ -308,6 +312,8 @@ class Player(Movable):
t = Transition(self.game,time=1,holdtime=0.5,level=self.game.globals["levelname"])
self.game.gameloop.summon(t)
self.game.addParticle([self.spritehurt],self.rect.center[0],self.rect.center[1],fps=0.6,vely=-1.5,modvely=0.15) # Die sprite
def draw(self):
if not self.dead:
flipy = (self.gravityway<0 and not self.leaptimer<0)

View File

@ -5,7 +5,7 @@ class Water(BaseObject):
def __init__(self,game):
self.tileset = game.gameloop.findname("TilesetRenderer")[0]
y = self.tileset.spawns[0].center[1]+game.globals["camerah"]/2
y = self.tileset.layers[0]["surface"].get_height()+8
self.destinationy = y
super().__init__(0,y,game,game.globals["cameraw"],game.globals["camerah"])