Handling animations underwater

This commit is contained in:
theo@manjaro 2021-11-17 21:39:18 +01:00
parent 07c79e8f7a
commit b09d747efe
1 changed files with 3 additions and 3 deletions

View File

@ -65,7 +65,7 @@ class Player(Movable):
# Small leap in order to get out of the water
self.leaptimer = 1
self.leapmaxtimer = 0.5
self.leapmargin = 35 # Vertical margin for the leap
self.leapmargin = 30 # Vertical margin for the leap
self.gravityway = 1
@ -73,7 +73,6 @@ class Player(Movable):
if not self.hitpose:
if self.water and self.rect.y>self.water.rect.y: # Reverse gravity underwater
if self.gravityway == 1:
self.gravityway = -1
@ -120,6 +119,7 @@ class Player(Movable):
self.onceilling = False
if self.checkcollisions(0,self.gravityway):
self.onground = True
self.leaptimer = self.leapmaxtimer
self.candash = True
self.canfastfall = True
if self.fastfall:
@ -213,5 +213,5 @@ class Player(Movable):
self.game.globals["cameray"] = self.rect.center[1]-self.game.globals["camerah"]/2
def draw(self):
sprite = self.game.pygame.transform.flip(self.sprite,self.flipx,False)
sprite = self.game.pygame.transform.flip(self.sprite,self.flipx,self.gravityway<0 and not self.leaptimer<0)
self.game.window.blit(sprite,[self.rect[0]-self.game.globals["camerax"],self.rect[1]-self.game.globals["cameray"]])