コード例 #1
0
ファイル: main.py プロジェクト: LesivLev/Game1
            bullet = Bullet(all_zombies.sprites()[0])
            all_sprites.add(bullet)
            player.score -= 1

    if keystate[pygame.K_ESCAPE]:
        isStopped = True

    hits = pygame.sprite.spritecollide(player, all_zombies, False)
    for hit in hits:
        player.hit()
        if (player.hp <= 0):
            run = False

    hits = pygame.sprite.spritecollide(player, all_walls, False)
    for hit in hits:
        player.hitwall(wall, keystate)

    if isBulletActive:
        hits = pygame.sprite.spritecollide(bullet, all_zombies, False)
        for zombie in hits:
            bullet.remove(all_sprites)
            # удалить спрайт пули
            isBulletActive = False
            zombie.Hp()
            player.score += 2
            if zombie.hp == 0:
                if ifLevelup == False:
                    zombie.regenerate()
                    killedZombie += 1
                    player.score += 10
                else: