0

I am making a Street fighter type game for a school project using pygame and i am trying to add a system to punish the player when missing basic punch. Like a recover time between attacks.

I am trying to have the player wait 2-3 seconds until he can move/ attack again after attacking. Punch_time is defined as soon as the punch button is pressed Start time is defined when the program starts to track the time. Then the program waits until its been 3 seconds then stops the punch This code is in a while loop that keeps the game running

  self.punch_time = pygame.time.get_ticks()
                
                if self.game_loop.start_time - self.punch_time >= self.recover_secs * 3000: 

                    self.game_loop.player.set_sub_state(Sub_States.NONE)
                    self.game_loop.player.set_state(States.STANDING)

Does anyone know how to fix this so there is a 3 second gap before the player can do something after punching. Thanks

0 Answers0