]> Skullheadx's Git Forge - Pygame-Jam.git/commitdiff
Merge branch 'main' of https://github.com/Skullheadx/Pygame-Jam
authorlbcmk <30442978+lbcmk@users.noreply.github.com>
Thu, 7 Jul 2022 22:02:43 +0000 (18:02 -0400)
committerlbcmk <30442978+lbcmk@users.noreply.github.com>
Thu, 7 Jul 2022 22:02:43 +0000 (18:02 -0400)
1  2 
Actors.py
Player.py

diff --cc Actors.py
Simple merge
diff --cc Player.py
index fc1ae910725fb6d3b2b3ee9c821dc69d2d89095d,b93c991a55980d34310944ba52bdbb956cd18bb1..d0fe9c2d93194c42d338b104f8302e5843ccee34
+++ b/Player.py
@@@ -43,34 -34,12 +43,37 @@@ class Player(Actor)
              self.jump()
          if pressed[pg.K_a] or pressed[pg.K_LEFT]:
              self.move_left()
 +            if(self.lastValueL == False):
 +                timeSincePressed = datetime.utcnow() - self.lastPressedLeft
 +                timeSinceLastDash = datetime.utcnow() - self.lastDash
 +
 +                if(timeSincePressed < timedelta(seconds=0, microseconds=500000) 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]:
              self.move_right()
 +            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):
 +                    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.lastPressedRight = datetime.utcnow()        
 +        
 +        self.lastValueL = pressed[pg.K_a] or pressed[pg.K_LEFT]
 +        self.lastValueR = pressed[pg.K_d] or pressed[pg.K_RIGHT]
  
+     def attack(self, enemy, weapon):
+         self.modify_health(-10,"enemy")
      def draw(self, surf):
          super().draw(surf)
          # print(self.position, self.velocity, get_display_rect(self.get_collision_rect()).topleft, Setup.camera_offset)