From: lbcmk <30442978+lbcmk@users.noreply.github.com> Date: Thu, 7 Jul 2022 22:15:48 +0000 (-0400) Subject: Fixed a double dash bug X-Git-Url: http://git.skullheadx.com/phil/index.html?a=commitdiff_plain;h=9864e6d11c0076843a11eab6f56fb375503c3495;p=Pygame-Jam.git Fixed a double dash bug --- diff --git a/Player.py b/Player.py index 24d58f7..e25333f 100644 --- a/Player.py +++ b/Player.py @@ -47,13 +47,12 @@ class Player(Actor): if(self.lastValueL == False): timeSincePressed = datetime.utcnow() - self.lastPressedLeft timeSinceLastDash = datetime.utcnow() - self.lastDash - + if(timeSinceLastDash >= self.dashCooldown): self.dashPossible = True + else: self.dashPossible = False if(timeSincePressed < self.timeBetweenDoublePress and self.dashPossible == True): self.move_left(self.dashSpeed) # change this to change how the player dashes (maybe replace with a custom dash function) self.dashPossible = False self.lastDash = datetime.utcnow() - if(timeSinceLastDash >= self.dashCooldown): - self.dashPossible = True self.lastPressedLeft = datetime.utcnow() if pressed[pg.K_d] or pressed[pg.K_RIGHT]: @@ -61,12 +60,12 @@ class Player(Actor): if(self.lastValueR == False): timeSincePressed = datetime.utcnow() - self.lastPressedRight timeSinceLastDash = datetime.utcnow() - self.lastDash + if(timeSinceLastDash >= self.dashCooldown): self.dashPossible = True + else: self.dashPossible = False if(timeSincePressed < self.timeBetweenDoublePress and self.dashPossible == True): - self.move_right(self.dashSpeed) # change this to change how the player dashes (maybe replace with a custom dash function) - self.dashPossible = False self.lastDash = datetime.utcnow() - if(timeSinceLastDash >= self.dashCooldown): - self.dashPossible = True + self.dashPossible = False + self.move_right(self.dashSpeed) # change this to change how the player dashes (maybe replace with a custom dash function) self.lastPressedRight = datetime.utcnow() self.lastValueL = pressed[pg.K_a] or pressed[pg.K_LEFT]