Exemplo n.º 1
0
        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):
            pass
        if Collision.hero_and_left_border_of_block(block, map.hero):
            pass
        if Collision.hero_and_right_border_of_block(block, map.hero):
            pass

        for bullet in map.bullets:
            if Collision.bullet_and_target(bullet, block):
                map.remove_bullet(bullet)

    for enemy in map.emenies:
        if Collision.enemy_attack(enemy, map.hero):
            text = map.font.render('-5', 1, (255, 0, 0))
            window.blit(text, (250 - (text.get_width() / 2), 200))
            map.hero.score -= 5
            map.hero.hit()

    keys = pygame.key.get_pressed()