Exemple #1
0
    def draw(self, screen):

        gun_img = Weapon.get_weapon_image(self.current_weapon)

        if self.direction == Direction.WEST:
            screen.blit(
                gun_img,
                (self.centerx - gun_img.get_rect().width, self.centery))

        elif self.direction == Direction.EAST:
            gun_img = pygame.transform.flip(gun_img, True, False)
            screen.blit(gun_img, (self.centerx, self.centery))

        elif self.direction == Direction.SOUTH:
            gun_img = pygame.transform.rotate(gun_img, 90)  # CCW
            screen.blit(gun_img, (self.centerx, self.centery))

        # weapon drawn below survivor
        elif self.direction == Direction.NORTH:
            south = pygame.transform.rotate(gun_img, 90)
            gun_img = pygame.transform.flip(south, False, True)
            screen.blit(
                gun_img,
                (self.centerx, self.centery - gun_img.get_rect().height))

        screen.blit(self.img, (self.x, self.y))
Exemple #2
0
    def draw(self, screen):

        gun_img = Weapon.get_weapon_image( self.current_weapon )

        if self.direction == Direction.WEST:
            screen.blit(gun_img, (self.centerx - gun_img.get_rect().width, self.centery))

        elif self.direction == Direction.EAST:
            gun_img = pygame.transform.flip(gun_img, True, False)
            screen.blit(gun_img, (self.centerx, self.centery))

        elif self.direction == Direction.SOUTH:
            gun_img = pygame.transform.rotate(gun_img, 90)  # CCW
            screen.blit(gun_img, (self.centerx, self.centery))
        
        # weapon drawn below survivor
        elif self.direction == Direction.NORTH:
            south = pygame.transform.rotate(gun_img, 90)
            gun_img = pygame.transform.flip(south, False, True)
            screen.blit(gun_img, (self.centerx, self.centery - gun_img.get_rect().height))

        screen.blit(self.img, (self.x, self.y))