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]:
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]