From: lbcmk <30442978+lbcmk@users.noreply.github.com> Date: Thu, 7 Jul 2022 22:05:28 +0000 (-0400) Subject: Small Fixes for the dash X-Git-Url: http://git.skullheadx.com/sitemap.xml?a=commitdiff_plain;h=822cfef47906ef6b765faa23d8bd7cf9bf24215d;p=Pygame-Jam.git Small Fixes for the dash --- diff --git a/Player.py b/Player.py index d0fe9c2..24d58f7 100644 --- a/Player.py +++ b/Player.py @@ -17,6 +17,7 @@ class Player(Actor): super().__init__(pos, collision_layer, collision_mask) self.initial_position = pg.Vector2(pos) self.dashCooldown = timedelta(seconds=2, microseconds=500000) + self.timeBetweenDoublePress = timedelta(seconds=0, microseconds=500000) self.dashSpeed = 5 self.dashPossible = True @@ -47,7 +48,7 @@ class Player(Actor): timeSincePressed = datetime.utcnow() - self.lastPressedLeft timeSinceLastDash = datetime.utcnow() - self.lastDash - if(timeSincePressed < timedelta(seconds=0, microseconds=500000) and self.dashPossible == True): + 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() @@ -60,7 +61,7 @@ class Player(Actor): if(self.lastValueR == False): timeSincePressed = datetime.utcnow() - self.lastPressedRight timeSinceLastDash = datetime.utcnow() - self.lastDash - if(timeSincePressed.seconds == 0 and timeSincePressed.microseconds < 500000 and self.dashPossible == True): + 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()