Exemplo n.º 1
0
while run:
    clock.tick(27)
    if shoot_loop > 0:
        shoot_loop += 1
    if shoot_loop > 3:
        shoot_loop = 0

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False

    for bullet in map.bullets:
        for enemy in map.emenies:
            if not enemy.visible:
                map.remove_enemy(enemy)
            if Collision.bullet_and_target(bullet, enemy):
                enemy.hit()
                map.hero.score += 1
                map.remove_bullet(bullet)
        if bullet.x < 1280 and bullet.x > 0:
            bullet.x += bullet.vel
        else:
            map.remove_bullet(bullet)

    for block in map.blocks:
        if Collision.hero_on_block(block, map.hero) and not map.hero.is_jump:
            map.hero.y = block.hitbox[1] - 52
            map.hero.faling = False
        else:
            map.hero.faling = True
        if Collision.hero_under_block(block, map.hero):