MCPcopy Index your code
hub / github.com/geekcomputers/Python / attack

Method attack

Street_Fighter/src/fighter.py:177–190  ·  view source on GitHub ↗
(self, target)

Source from the content-addressed store, hash-verified

175 self.attack_cooldown = 20
176
177 def attack(self, target):
178 if self.attack_cooldown == 0:
179 # execute attack
180 self.attacking = True
181 self.attack_sound.play()
182 attacking_rect = pygame.Rect(
183 self.rect.centerx - (2 * self.rect.width * self.flip),
184 self.rect.y,
185 2 * self.rect.width,
186 self.rect.height,
187 )
188 if attacking_rect.colliderect(target.rect):
189 target.health -= 10
190 target.hit = True
191
192 def update_action(self, new_action):
193 # check if the new action is different to the previous one

Callers 1

moveMethod · 0.95

Calls 1

playMethod · 0.80

Tested by

no test coverage detected