From 6f246354c77318eb83afb1a283f02b5f9452a6bd Mon Sep 17 00:00:00 2001 From: Nikolya Andreychik Date: Wed, 7 Apr 2021 14:09:07 -0700 Subject: [PATCH] Added calculation of MaxHoverCount by gameSpeed --- Player.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/Player.py b/Player.py index 7c05c9c..8e4e133 100644 --- a/Player.py +++ b/Player.py @@ -142,6 +142,9 @@ class Player(pygame.sprite.Sprite): elif event.key in self.buttonsJump: self.isDownJump = False + def calcMaxHoverCount(self, speed): + return 26.57 - 6.23*math.log(speed) + 23.82*(1/speed) + 0.086*speed + def update(self): self.updateCount += 1 @@ -168,21 +171,7 @@ class Player(pygame.sprite.Sprite): gameSpeed = self.mainGameClass.getGameSpeed() if self.isJumping: - if gameSpeed <= 2: maxHoverCount = 40 - elif gameSpeed <= 4: maxHoverCount = 28 - elif gameSpeed <= 5: maxHoverCount = 23 - elif gameSpeed <= 7: maxHoverCount = 20 - elif gameSpeed <= 8: maxHoverCount = 18 - elif gameSpeed <= 10: maxHoverCount = 16 - elif gameSpeed <= 11: maxHoverCount = 15 - elif gameSpeed <= 13: maxHoverCount = 14 - elif gameSpeed <= 15: maxHoverCount = 13 - elif gameSpeed <= 17: maxHoverCount = 12 - elif gameSpeed <= 22: maxHoverCount = 11 - elif gameSpeed <= 26: maxHoverCount = 10 - elif gameSpeed <= 32: maxHoverCount = 9 - elif gameSpeed <= 43: maxHoverCount = 8 - else: maxHoverCount = 7 + maxHoverCount = self.calcMaxHoverCount(gameSpeed) if self.isDownJump and self.hoverCount < maxHoverCount: self.speed -= gameSpeed/8 * (