Exemplo n.º 1
0
    def update(self):
        if self.rect.left <= 647:
            self.rect.x = self.rect.x
            self.can_shoot = True
        else:
            self.rect.x += self.speedx

        if self.lives <= 0:
            self.kill()
            score_lis.append(self.score_value)
            boss_weakpoint_lis[1] = False

        detect_collisions_enemy_playerbullets(self, its_boss=True)

        if 0 <= abs(
                player.rect.centery - self.rect.centery
        ) <= 14 and self.weapon_delay >= 30 * 3 and player.is_alive == True and self.can_shoot == True:
            self.shoot()
            self.shooted = True

        if self.shooted == True:
            self.weapon_delay -= 1

        if self.weapon_delay <= 0:
            self.shooted = False
            self.weapon_delay = 30 * 3

        detect_collisions_enemy_playerbullets(self)
Exemplo n.º 2
0
    def update(self, screen=screen, player=player):
        if self.lives < 0:
            self.kill()
            score_lis.append(self.score_value)
        self.stalkPlayer(player)

        screen.blit(self.image, self.rect)
Exemplo n.º 3
0
    def update(self, screen=screen, player=player):
        if self.lives < 0:
            self.kill()
            score_lis.append(self.score_value)
            global enemy3_its_alive
            enemy3_its_alive = False
            global STAGE_TIME
            if STAGE_TIME >= 7410:
                enemies_lis[1] = False
        #self.stalkPlayer(player)

        if self.timing_to_start_stalking > 0:
            self.timing_to_start_stalking -= 1

        if self.timing_to_start_stalking <= 0:
            self.stalkPlayer(player)

        screen.blit(self.image, self.rect)

        if 0 <= abs(
                player.rect.centery - self.rect.centery
        ) <= 14 and self.weapon_delay >= 30 and player.is_alive == True:
            self.shoot()
            self.shooted = True

        if self.shooted == True:
            self.weapon_delay -= 1

        if self.weapon_delay <= 0:
            self.shooted = False
            self.weapon_delay = 30

        detect_collisions_enemy_playerbullets(self)
Exemplo n.º 4
0
    def update(self, screen=screen, player=player):
        if self.lives < 0:
            self.kill()
            score_lis.append(self.score_value)
        self.stalkPlayer(player)

        screen.blit(self.image, self.rect)

        detect_collisions_enemy_playerbullets(self)
Exemplo n.º 5
0
    def update(self):

        print(self.rect.centerx, self.rect.centery)

        self.rect.x += self.speedx
        if self.rect.left < (0 - self.rect.width):
            self.kill()
            print("morreu")
        if self.lives <= 0:
            self.kill()
            score_lis.append(self.score_value)

        if 0 <= abs(player.rect.center[0] -
                    self.rect.center[0]) <= self.rect.width * 4 and 0 <= abs(
                        player.rect.center[1] -
                        self.rect.center[1]) <= self.rect.height * 4:
            self.start_timing = True

        if self.timing_to_mine_explosion <= 0:
            self.start_timing = False
            self.start_exploding_timing = True
            if self.start_exploding_timing == True:
                self.exploding_animation_timing -= 2
                self.explode()
                if self.exploding_animation_timing <= 0:
                    self.kill()
            print("explodiu")
            # error

        # come back
        """enemy11_hits_player_bullet = pygame.sprite.groupcollide(enemy11_group, bullets, False, True)
        if enemy11_hits_player_bullet:
            self.lives -= player.atackdamage
            self.start_timing = True
            print("perdeu hp")

        enemy11_hits_power_up_1_basic_bullet = pygame.sprite.groupcollide(enemy11_group, power_up_1_bullet_g, False, True)
        if len(enemy11_hits_power_up_1_basic_bullet) >= 1:
            self.lives -= power_up_gun09.atackdamage
            self.start_timing = True

        enemy11_hits_power_up_1_1_basic_bullet = pygame.sprite.groupcollide(enemy11_group, power_up_1_1_bullet_g, False, True)
        if len(enemy11_hits_power_up_1_1_basic_bullet) >= 1:
            self.lives -= power_up_gun10.atackdamage
            self.start_timing = True"""

        if self.start_timing == True:
            self.timing_to_mine_explosion -= 1
            if self.timing_to_mine_explosion in self.its_on_lis:
                self.image = enemy4_on_img
                self.image.set_colorkey(BLACK)
            elif self.timing_to_mine_explosion in self.its_off_lis:
                self.image = enemy4_off_img
            print(self.timing_to_mine_explosion)
Exemplo n.º 6
0
    def update(self, screen=screen, player=player):
        if self.lives < 0:
            self.kill()
            score_lis.append(self.score_value)
            global enemy2_its_alive
            enemy2_its_alive = False
            global STAGE_TIME
            if STAGE_TIME >= 7410:
                enemies_lis[0] = False

        if self.timing_to_start_stalking > 0:
            self.timing_to_start_stalking -= 1

        if self.timing_to_start_stalking <= 0:
            self.stalkPlayer(player)

        screen.blit(self.image, self.rect)

        detect_collisions_enemy_playerbullets(self)
Exemplo n.º 7
0
    def update(self, screen=screen, player=player):
        if self.lives < 0:
            self.kill()
            score_lis.append(self.score_value)
        self.stalkPlayer(player)

        screen.blit(self.image, self.rect)

        if 0 <= abs(
                player.rect[1] - self.rect[1]
        ) <= 14 and self.weapon_delay >= 30 and player.is_alive == True:
            self.shoot()
            self.shooted = True

        if self.shooted == True:
            self.weapon_delay -= 1

        if self.weapon_delay <= 0:
            self.shooted = False
            self.weapon_delay = 30
Exemplo n.º 8
0
    def update(self):

        print(self.rect.centerx, self.rect.centery)

        self.rect.x += self.speedx
        if self.rect.left < (0 - self.rect.width):
            self.kill()
            #print("morreu")
        if self.lives <= 0:
            self.kill()
            score_lis.append(self.score_value)

        if 0 <= abs(player.rect.center[0] -
                    self.rect.center[0]) <= self.rect.width * 4 and 0 <= abs(
                        player.rect.center[1] -
                        self.rect.center[1]) <= self.rect.height * 3:
            self.start_timing = True

        if self.timing_to_mine_explosion <= 0:
            self.start_timing = False
            self.start_exploding_timing = True
            if self.start_exploding_timing == True:
                self.exploding_animation_timing -= 2
                self.explode()
                if self.exploding_animation_timing <= 0:
                    self.kill()
            #print("explodiu")

        detect_collisions_enemy_playerbullets(sprite1=self,
                                              its_enemy4_type=True)

        if self.start_timing == True:
            self.timing_to_mine_explosion -= 1
            if self.timing_to_mine_explosion in self.its_on_lis:
                self.image = enemy4_on_img
                self.image.set_colorkey(BLACK)
            elif self.timing_to_mine_explosion in self.its_off_lis:
                self.image = enemy4_off_img
            print(self.timing_to_mine_explosion)