Exemplo n.º 1
0
 def contact(self, player: sprite.Sprite):
     """Detect collision between player and enemy polygons and reduce their hull.
     player:     player sprite"""
     for enemy in sprite.spritecollide(player, self, False,
                                       sprite.collide_circle):
         player.knockback(enemy)
         enemy.damage()
         player.damage()
Exemplo n.º 2
0
 def harm(self, player: sprite.Sprite):
     """Detect collision between player and enemy fire and reduce hull.
     player:     player sprite"""
     for _ in sprite.spritecollide(player, self, True,
                                   sprite.collide_circle):
         player.damage()