From 9864e6d11c0076843a11eab6f56fb375503c3495 Mon Sep 17 00:00:00 2001 From: lbcmk <30442978+lbcmk@users.noreply.github.com> Date: Thu, 7 Jul 2022 18:15:48 -0400 Subject: [PATCH] Fixed a double dash bug --- Player.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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] -- 2.54.0